Indeed. To compare, in C++ there is '::' scope resolution operator, and '.' member access operator. In fbc we use '.' (dot) operator for both, for example:badidea wrote:I think I got another addition. There seems to be no .. page. Don't know if it has a name.
Code: Select all
namespace N1
dim X as integer
end namespace
namespace N2
dim X as integer
end namespace
using N1 '' import namespace
using N2 '' import namespace
print N1.X '' OK '.' operator resolves scope
print N2.X '' OK '.' operator resolves scope
print X '' error: abiguous symbol access
Code: Select all
sub proc()
print "global proc()"
end sub
namespace N
const false as integer = 111
const true as integer = 999
sub proc()
print "N.proc()"
end sub
sub test()
proc() '' call N.proc()
..proc() '' call global proc()
'' N.false, N.true
print false, true
'' global false, true
print ..false, ..true
end sub
end namespace
N.test()
Also, not sure if this is a bug or a side effect of shadowing, or just a bad example on my part:
Code: Select all
'' not quite the same for variables
dim y as integer = 1
scope
dim y as integer = 2
print y '' prints 2
print ..y '' prints 2
end scope