'
hello charles, this o2 code example about inner-modules and macro prefixes doesnt work here, have you another one for me
how that's working ? thanks
'
$ client ...
int x=0
print client.x '0 'error
namespace aa
int x=2
print client.x '0
namespace bb
int x=4
print client.x '2
namespace cc
int x=6
print client.x '4
end namespace
'print ..cc..x '6
end namespace
end namespace
print "not ok"
' thx frank
This is derived from a nested namespace experiment from inf/testlog3.02bas (2022).
client only needs an extra dot to make it work in the current o2 :)
$ client ....
int x=0
print client.x
namespace aa
int x=2
print client.x '0
namespace bb
int x=4
print client.x '2
namespace cc
int x=6
print client.x '4
end namespace
'print ..cc..x '6
end namespace
end namespace
The problem is we don't yet have a good use-case for nested namespaces.
thank you charles, didn't know yet this example
learning new things again ;)
how would this example below looks like with a module prefix macro?
'
module
namespace abc
uses console
end namespace
$ client ....
int x=0
print client.x ' 0
namespace aa
int x=2
print client.x '0
namespace bb
int x=4
print client.x '2
namespace cc
int x=6
print client.x '4
end namespace
print ..cc..x '6
end namespace
end namespace
end module
' thanks, frank
where would you use this kind of module feature with oxygen?
module currently has a null definition but you could use it like this:
'Supposing you wanted to create a module
'to contain all the core Windows calls:
======
module
======
% win windows..
namespace windows
uses corewin
end namespace
==========
end module
==========
'
'test
win.beep(432,500)
win.sleep(1000)
print "ok"
Yes I understand thanks..
' test module feature go, frank
'
module
======
namespace cons
uses console
end namespace
end module
% vcprint ..cons..output
% vcwait ..cons..getkey
% vtab ..cons..tab
vcprint 12345678 vtab "hello steve jobs" vtab
vcprint "thank you for apple computers"
vcwait
' ends