Different behaviour between interactive and not interactive usage
"norbertmuellerde" <[email protected]> Sat, 03 Mar 2012 16:31:09 -0000
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am trying to use Io under Ubuntu 10.04
and have a strange behaviour:
% cat operator.io
OperatorTable addOperator (":",1)
Object : := method (a, self print; a println)
1 : 3
% io operator.io
1nil
% io < operator.io
Io 20110905
Io> OperatorTable addOperator (":",1)
==> OperatorTable_0x8704dc0:
Operators
0 ? @ @@
1 ** :
2 % * /
3 + -
4 << >>
5 < <= > >=
6 != ==
7 &
8 ^
9 |
10 && and
11 or ||
12 ..
13 %= &= *= += -= /= <<= >>= ^= |=
14 return
Assign Operators
::= newSlot
:= setSlot
= updateSlot
To add a new operator: OperatorTable addOperator("+", 4) and implement the + message.
To add a new assign operator: OperatorTable addAssignOperator("=", "updateSlot") and implement the updateSlot message.
Io> Object : := method (a, self print; a println)
==> method(a,
self print; a println
)
Io> 1 : 3
13
==> 3
Io>
%
So it seems that the interpreter sees the argument for operator : only in interactive mode.
Could that be a bug?
Thanks in advance