Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6625783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:48:54+00:00 2026-05-25T21:48:54+00:00

Is this possible? To make a concrete example, consider the following macro: define pos

  • 0

Is this possible?

To make a concrete example, consider the following macro:

define pos
po ([self $arg0])
end

So now if I input pos text, it gets turned into po [self text]. But with multiple arguments, it fails, e.g. pos textLabel text gets turned into po [self textLabel] rather than the desired po [[self textLabel]text].

For another example, just as the three commands

po someIvar_
po [self someMethod]
po [[self someMethod]someOtherMethod] 

print out the descriptions of the three objects referenced, it would be great to define a macro pi that does the same thing for integers, i.e.

pi [self someMethod] 

is the same as calling

print (int)[self someMethod], 

and similarly for

pi [[self someMethod]someOtherMethod].
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:48:55+00:00Added an answer on May 25, 2026 at 9:48 pm

    user-defined commands are just a bit more than string-replaces before executing. Your example pos textLabel text passes two parameters to a command which only considers one parameter. The second is thrown away. It should result in po [self textLabel] before executing. What you do is comparable to the following java-sum-function:
    int sum(int[] args){return args.get(0);}

    what you need is sth mentioned here :

    define pos
        if $argc == 1
            po [self $arg0]
        end
        if $argc == 2
            po [[self $arg0] $arg1]
        end
        ..... (as many you need)
    end
    

    I have not found any kind of a loop. So this should be the only way to do this except it is possible to to pop arg0 out of args and recursive-calls of user-defined-commands are allowed. But I think its easier to complete the example above.

    pi should be implemented the same way

    define pi
        if $argc == 1
            print (int)[self $arg0]
        end
        if $argc == 2
            print (int)[[self $arg0] $arg1]
        end
        ....
    end
    

    maybe there is a better solution but this brings you a step further towards your destination.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a variable length array in Javascript. Is this possible. A
Is it possible to make a progressbar in Java like displayed on this page?
i'm wondering about this possibility. Is it possible to make our code written in
I'm calling a SSIS package using LoadPackage(...). Is it possible to make this call
$(#tab1).click(function(){ loadTab(1); $('div.HOMEtabdiv ul.HOMEtabs a').removeClass('selected'); $(this).addClass('selected'); }); Would it be possible to make the
I want to make this specialized w/o changing main. Is it possible to specialize
I'll try to make this as straight forward as possible. Currently our team has
Right now I the following: 1) A java interface. 2) A concrete java class
How can I make this possible? <script type=text/javascript> var id = 10; <% @comment
I wounder how its possible to make a shape like the example, with round

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.