ooc-dev team mailing list archive
-
ooc-dev team
-
Mailing list archive
-
Message #00088
Re: j/ooc doesn't allow unqualified member access.
You're right about the potential for not knowing where a variable comes from,
but the programmer is smart enough to avoid that in the cases where it becomes
confusing. We *could* force them to use "This a + this b + This c + d" or
whatever, but I would much rather allow them to be used unqualified and let the
programmer use qualification where it makes sense.
As for not all programmers being sane, I don't think forcing them to qualify
their static member accesses will fix them...
On Friday 09 April 2010 20:39:42 Oddity007 wrote:
> A question I'm not sure has been asked is whether it would be easy to
> distiquish whether a member is that of the class, of it's instance, a
> local variable, or a global variable.
>
> Imagine the following that is several functions down the file within a
> class declaration.
>
> ...
> foo: func->Int{
> .... couple lines in
> return a+b+c+d
> }
>
> If I ever saw this line, I would remove all hair upon my noggin
> barehanded! "a" could be "This a", "this a", the global var "a", or a
> local, same applies to the other variables, with which the poor reader
> would have to manually trackdown which is declared where.
>
> I'm not really one to like forcing of a coding style (much of the
> reason why I disagree with enforcing lowercase function names), but
> this is something to think of.
>
> And while no sane coder would allow such vile code to be written, it
> is common knowledge that not everyone is sane. But why am I
> explaining the reasoning of PERL?
>
> On Apr 9, 2010, at 6:05 PM, Scott Olson <scott@xxxxxxxxxxxxxxx> wrote:
> > In j/ooc you can't access static members without prepending "This ".
> > I don't think this should be enforced, but rather simply mentioned
> > in the
> > style guide ORC (which still needs to be written, btw). It
> > especially doesn't
> > make sense with constants, eg. in oos, functions inside Display
> > class have to
> > use "This VIDEO_MEMORY" instead of just "VIDEO_MEMORY". According to
> > the erorr
> > message given when you don't use "This", this was done for 'clean
> > code', but
> > in my opinion it is sometimes cleaner without "This" and the option
> > should be
> > left to the user.
> >
> > See http://github.com/tsion/oos/blob/covers-and-
> > statics/Src/Kernel/Hal/Display.ooc
> >
> > I don't believe it would make it any cleaner to pepper that code
> > with "This".
> > In fact quite the opposite.
> >
> > In j/ooc, all you have to do is remove 3 lines of code that call that
> > exception and it all works fine. I don't know what must be done in
> > rock, but it
> > should also be able to do unqualified member access.
> >
> > if anyone else has any thoughts or arguments, I'd like to hear them.
> >
> > - Scott Olson
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~ooc-dev
> > Post to : ooc-dev@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~ooc-dev
> > More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ooc-dev
> Post to : ooc-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ooc-dev
> More help : https://help.launchpad.net/ListHelp
Follow ups
References