Home > Community > Forums > Custom IC SKILL > Type casting boolean?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Type casting boolean? 

Last post Wed, Sep 30 2009 1:04 PM by markbeck. 2 replies.
Started by markbeck 30 Sep 2009 12:04 PM. Topic has 2 replies and 1168 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Sep 30 2009 12:04 PM

    • markbeck
    • Top 200 Contributor
    • Joined on Thu, Jun 30 2011
    • Beaverton, OR
    • Posts 45
    • Points 1,355
    Type casting boolean? Reply

    I'm trying to type cast a variable as boolean, but I keep getting some wierd error when I try to use it.

    For example I've got the following code:

    (defmacro mytest (foo "b") foo) 

    If I try to execute: foo(t) I get the following error:

    *Error* mytest: argument #1 should be ddUserType (type template = "b") - t

    From what I understand, ddUserType is a boolean.  

    Where did I mess up?

    Mark

    • Post Points: 20
  • Wed, Sep 30 2009 12:51 PM

    Re: Type casting boolean? Reply
    Mark,

    Three things:

    1. "b" does not mean "boolean". It means a "dd" object. Hence passing a t will fail the type check, because it is not a dd object (as returned by ddGetId()).

    2. There is no boolean type in SKILL. So there is no type checking letter for it. In SKILL, nil means false (and nil is an empty list, so is an "l" type), and anything else means true.

    3. The string at the end of the formal parameter list is for type _checking_ not type _casting_.

    Regards,

    Andrew
    • Post Points: 20
  • Wed, Sep 30 2009 1:04 PM

    • markbeck
    • Top 200 Contributor
    • Joined on Thu, Jun 30 2011
    • Beaverton, OR
    • Posts 45
    • Points 1,355
    Re: Type casting boolean? Reply

    Sorry I mis-typed, I meant to askabout type checking, not type casting.

    Thanks for the info.  I guess I'll just have to check the variable internally

    Mark

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by markbeck at 30 Sep 2009 12:04 PM. Topic has 2 replies.