Re: . or : for namespace?
- Posted by Matt Lewis <matthewwalkerlewis at g?ai?.com> May 06, 2008
- 701 views
Jeremy Cowgar wrote: > > The above *does* err out. That error message is pasted from the actual output > of that program. That's what I get for not testing. Thinking about it, though, it does make sense, because the namespace is a symbol in the same scope as m. > Now, also, please see my post: > > http://www.openeuphoria.org/EUforum/m20548.html > > That will address the above example a little more. I think you meant m20546? Unless you've changed your name... > > > So, what does s.m.n mean? It could mean either s[1][3] or s[2]. I > > suppose that we could disallow using a fully qualified reference with the > > dot notation. Frankly, I'm not big on this sort of dot notation, either. > > I don't see anything wrong with using square brackets. > > > > I think the dot notation would be best reserved for implementing some sort > > of structured access/OO. > > > > Let's dive into the example. Let's say we do have dotted structure access. > What > is it going to access? In your example above: > > }}} <eucode> > ? s.m:n -- {5,6,7,8} > </eucode> {{{ > > When reading this with . for structure and : for namespace. > > "s" is a variable of some sort. Now, a variable can contain a namespace? That > doesn't make sense. You are accessing a variable, so inside the structure, > there > can be multiple "n" variables that you have to prefix them with a namespace? > That would mean: There's a lot to hash out about what dotted access might mean. Some have used a dot as syntactic sugar for enclosing something within square brackets. I don't think that's a good idea. I was just using namespaces to qualify the subscripts. So, I retract the error argument, since it's already an error. But I still think the distinctiveness of : vs . is enough to keep the : for namespaces. Matt