« Return to Thread: Quick Questions

Quick Questions

by Michael Witten :: Rate this Message:

Reply to Author | View in Thread

Is it possible to implement 'break' and 'continue' in Io?

Should 'break' and 'continue' be considered operators?

Should 'return' be referred to as a "method"?
("Any part of a block can return immediately using the return method")

Is it necessary to give 'return' special syntax?

How can one create user-defined operators?
["User defined operators (that don't have a standard operator name) are
   performed left to right."]

It's not immediately obvious how special 'keywords' and operators are
handled. For instance:

        Io> and := 1
        ==> 1
        Io> 1 + and
        ==> 2
        Io> and + 1
        ==> 1
        Io> and + 100
        ==> 1
        Io> and + and
        ==> 1

Also:

        Io> and := false
        ==> false
        Io> and or 1
        ==> false

Also:

        Io> return := 1
        ==> 1
        Io> 1 + return
        ==> 2
        Io> return + 1
        ==> 1

strange, but consistent:
(I imagine IDs/addresses are being compared;
  'true' must be created before 'false', an
  unsafe assumption some programmer could use):

        Io> true < false
        ==> true
        Io> false < true
        ==> false
        Io> true > false
        ==> false
        Io> false > true
        ==> true

Also, there is more special treatment:

        Io> false := true
        ==> true
        Io> false
        ==> false

Shouldn't 'true' and 'false' be slots of Lobby?

Thanks for your help,
Michael Witten

 « Return to Thread: Quick Questions

LightInTheBox - Buy quality products at wholesale price!