May 02, 2004
James McComb wrote:
> Unknown W. Brackets wrote:
> 
>> And JavaScript has always worked without the .'s.  If you just base things off other languages, you have to pick which - and I would note that Delphi and Visual Basic are not as "C like" as JavaScript is.
> 
> 
> Fair enough. I didn't know about JavaScript with blocks.
> Forget about other languages, then.
> 
>> Just your logic, though... maybe not everyone shares that logic.
> 
> 
> Maybe they don't, but maybe they should. ;)
> 
> Here are two other reasons why with block should have the dots.
> 
> 1. Readability
> 
> In the middle of a long function you come across:
> 
> with(a) {
>   x = y;
> }
> 
> Without the dots, you can't tell at a glance whether
> this means a.x = y or x = a.y or even just x = y!
> 
> 2. Auto-complete editor support
> 
> Inside a with block, you type a dot. Lo and behold, up
> pops a list of methods for the containing with block.
> 
>>> If this conflicts with the syntax for indicating
>>> global scope, I think it is the global scope syntax
>>> that should be changed:
>>> e.g. .x becomes ::x or global.x
>>>
>>
>> Or is bad.... makes things confusing I say.  If it means just one thing, it is more logical.  Not less.
> 
> 
> I am not suggesting that any construct have two meanings.
> I am suggesting something like:
> 
> .x always means the scope of the with block
> ::x always means global scope

I think it's kind of late in the game to be changing D with respect to these scope issues. Personally, I'm used to the with . convention that Visual Basic uses, but I like D's way, too. D's scope rules are already well-defined and they work.

But keep these suggestions coming, D still has some weak spots and different perspectives can shed light on them.

> 
> James McComb

-- 
Justin
http://jcc_7.tripod.com/d/
May 02, 2004
James, I agree with your arguments completely.

(I too didn't know about JavaScrip's behaviour; is there something missing
in my life....nope!)



"James McComb" <alan@jamesmccomb.id.au> wrote in message news:c71ift$27j5$1@digitaldaemon.com...
> Unknown W. Brackets wrote:
>
[snip - too much repartition]


1 2
Next ›   Last »