Sadly I must get back to serious matters instead of playing with Rosetta Code.
I've found the following problem with use of an initialiser on the local
statement. It happens when the local is inside a method AND the initialiser
tries to reference a member of the enclosing class. The following code
illustrates the problem clearly, and throws the following error:
Run-time error 103
File locinit.icn; Line 19
string expected
offending value: &null
Traceback:
main()
Broken_asString(record Broken__state_1(record Broken__state_1(4),record
Broken__methods_1(2),"Winnie","100 acre forest")) from line 32 in locinit.icn
{&null || " 100 acre forest"} from line 19 in locinit.icn
class Safe (named, addr)
method asString()
local buf
buf := named
buf ||:= " " || addr
return buf
end
initially (n, a)
named := n
addr := a
end
class Broken (named, addr)
method asString()
local buf := named
buf ||:= " " || addr
return buf
end
initially (n, a)
named := n
addr := a
end
procedure main()
x := Safe("Winnie", "100 acre forest")
y := Broken("Winnie", "100 acre forest")
write(x.asString())
write(y.asString())
end
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group