View mode: basic / threaded / horizontal-split · Log in · Help
March 08, 2005
Re: DMD 0.116 release
Matthew wrote:
> "John Demme" <me@teqdruid.com> wrote in message 
> news:d0itb3$pid$1@digitaldaemon.com...
> 
>>Warnings? Whoa!  Walter, I know you didn't like the idea of warnings, 
>>so thanks for at least giving it a try.  I'm sure we'll let you know 
>>what we think.
>>
>>Let me preface myself by saying that I haven't been following the $ or 
>>__FILE__ discussion (we've got waaay too much going on on this NG 
>>nowadays) so I aplogize if I'm stepping on anyone's toes.
>>
>>As for $, __FILE__, and __LINE__...
>>I think we (we of course meaning Walter) should make #<valid 
>>identifier> a meta-keyword...  Then we replace length with $length, 
>>__FILE__ with $file, ect... All other valid identifiers prefixed with 
>>$ should be illegal...  This way, when one wants to add features such 
>>as these, it will not break existing code, and will not necessitate 
>>additional keywords. Perhaps there are even more uses for these 
>>"meta-keywords" as well.
>>
>>Thoughts?
> 
> 
> Don't like it.
> 
> First: $ as a prefix may be getting a far more important and central 
> role in the language.
OK... show me what it is.  There are a few good symbols one could use: 
#$%~, ect... Pretty much anything one uses instead of swearing would do.

Also, $arguments, and $argptr, are good for this.  I'm sure they'll be 
more that might be appropriate.  I (obviously) like the idea of being 
able to add small features to the language without breaking code.  This 
means that we'd be able to get convient features between 1.0 and 2.0.

> 
> Second: __FILE__ and __LINE__ are damn ugly, and that's a good thing. 
> Making them less so might incline people to over/ab-use
> 
> Third: __FILE__ and __LINE__ are standard parts of other languages, and 
> widely recognised by most/all programmers. 

OK... how about $__FILE__ and $__LINE__? they're ugly now :)  Seriously, 
I don't buy it.  If a programmer's going to abuse something, then it 
going to be abused.  If a programmer don't know what abuse is, I'm not 
certain (s)he's gonna know what code beauty is either.  But maybe I'm 
outta my gourd.

John
March 08, 2005
Re: DMD 0.116 release
"Andrew Fedoniouk" <news@terrainformatica.com> wrote in message
news:d0itsj$q7v$1@digitaldaemon.com...
> Walter, beg my pardon but still unclear....

------------ old way, doesn't work anymore ------------------

module foo.bar;

void test() { }

void func()
{
   bar.test();
}

------------- new way ------------------

module foo.bar;

void test() { }

void func()
{
   foo.bar.test();
}

------------------------------------------
March 08, 2005
Re: DMD 0.116 release
> Simply put, $ would mean 'within the context of the innermost entity', 
> so:

Isn't the context of the innermost entity the default? :)
March 08, 2005
Using $ for localising symbol context [was Re: DMD 0.116 release]
"John Demme" <me@teqdruid.com> wrote in message 
news:d0iu6v$qk7$1@digitaldaemon.com...
> Matthew wrote:
>> "Walter" <newshound@digitalmars.com> wrote in message 
>> news:d0irlm$o0s$1@digitaldaemon.com...
>>
>>>I'm not too sure about $, __FILE__ or __LINE__. There might be a 
>>>better way.
>>>
>>>http://www.digitalmars.com/d/changelog.html
>>
>>
>> He he. I'm now inclining towards a more general approach to context 
>> dependency, following the $length, $count, etc. mentioned (by 
>> ??forgotten??; sorry) the other day.
>>
>> Simply put, $ would mean 'within the context of the innermost 
>> entity', so:
>
> I don't think that's the best definition,

That's why I put it in the quotes. I leave it to those more expert in 
programming linguistics to define the term. They'll be along shortly, 
you can be sure ...

> as I think that that's the default. The way I read it, these are 
> equivalent:
> array[4..length];
> and
> array[4..$length];
>
> It doesn't say anything about certain identifiers only existing after 
> a $.

No. I mean we dispense with the evil first form, and require anyone not 
wanting to write

   array[4 .. array.length]

to write

   array[4 .. $length]

>>
>>
>>     int[]    a = . . .
>>
>>     if( 0 != a.length &&
>>         a[$length - 1] == 10)
>>     {
>>            ...
>>
> Looking at the example, it seems to me what you want is that 
> $<identifier> is an alias for the property of the last variable in the 
> chain.  Example:
> a.b.c($something);
> the $something returns c.something if it exists, then b.something if 
> it exists, then a.something if it exists, or doesn't compile... or am 
> I looking too far into this?

No, you're not. I'm hoping very much all you smart cookies will look 
deeply into this idea, and solve all the riddles I've not even bothered 
to think about yet. :-)

I don't know if the definition would be 'last variable in the chain'; 
that's why I said 'within the context of the innermost entity'.

If others could chime in with different use cases, i.e. things other 
than array length, then I think we might be able to come up with 
something rather groovy.
March 08, 2005
Re: DMD 0.116 release
Hmmmm....

Can we just use "dot" for that?

if( 0 != a.length && a[ .length - 1] == 10)

[]  brackets establish context (pretty much as 'with')
a[.length-1] or
a[.last]

means as you said length of innermost array

.arguments[] vector may also work.









"Matthew" <admin@stlsoft.dot.dot.dot.dot.org> wrote in message 
news:d0itm4$q26$1@digitaldaemon.com...
>
> "Walter" <newshound@digitalmars.com> wrote in message 
> news:d0irlm$o0s$1@digitaldaemon.com...
>> I'm not too sure about $, __FILE__ or __LINE__. There might be a better 
>> way.
>>
>> http://www.digitalmars.com/d/changelog.html
>
> He he. I'm now inclining towards a more general approach to context 
> dependency, following the $length, $count, etc. mentioned (by 
> ??forgotten??; sorry) the other day.
>
> Simply put, $ would mean 'within the context of the innermost entity', so:
>
>
>    int[]    a = . . .
>
>    if( 0 != a.length &&
>        a[$length - 1] == 10)
>    {
>           ...
>
> Thus $ is not 'wasted' on array length, and neither $len nor $length (nor 
> anything else) are defined as some special funky kinds of keywords. 
> Rather, $X means that X is relative. Like a deeper/funkier with.
>
> I'll leave it to faster/sharper minds to come up with all the wild 
> ramifications of this ...
>
>
> :-)
>
>
>
March 08, 2005
Re: DMD 0.116 release
I see now. Thanks a lot, Walter, for comments.

Could you change then

import foo.bar;
to
module foo.bar;

here http://www.digitalmars.com/d/changelog.html#new0116 ?

Andrew.



"Walter" <newshound@digitalmars.com> wrote in message 
news:d0iuk9$r4j$1@digitaldaemon.com...
>
> "Andrew Fedoniouk" <news@terrainformatica.com> wrote in message
> news:d0itsj$q7v$1@digitaldaemon.com...
>> Walter, beg my pardon but still unclear....
>
> ------------ old way, doesn't work anymore ------------------
>
> module foo.bar;
>
> void test() { }
>
> void func()
> {
>    bar.test();
> }
>
> ------------- new way ------------------
>
> module foo.bar;
>
> void test() { }
>
> void func()
> {
>    foo.bar.test();
> }
>
> ------------------------------------------
>
>
March 08, 2005
Re: DMD 0.116 release
Andrew Fedoniouk wrote:
> Hmmmm....
> 
> Can we just use "dot" for that?
> 
> if( 0 != a.length && a[ .length - 1] == 10)
> 
> []  brackets establish context (pretty much as 'with')
> a[.length-1] or
> a[.last]
> 
> means as you said length of innermost array
> 
> .arguments[] vector may also work.
> 

.length should refer to the length variable defined in the outer scope.
March 08, 2005
Re: DMD 0.116 release
"Walter" <newshound@digitalmars.com> wrote in message 
news:d0iuk9$r4j$1@digitaldaemon.com...
>
> "Andrew Fedoniouk" <news@terrainformatica.com> wrote in message
> news:d0itsj$q7v$1@digitaldaemon.com...
>> Walter, beg my pardon but still unclear....
>
> ------------ old way, doesn't work anymore ------------------
>
> module foo.bar;
>
> void test() { }
>
> void func()
> {
>    bar.test();
> }
>
> ------------- new way ------------------
>
> module foo.bar;
>
> void test() { }
>
> void func()
> {
>    foo.bar.test();
> }
>
> ------------------------------------------

That's at least a lot more sensible.

Tell me, the rusty old twit, can alias work to disambiguate same-named 
functions from multiple modules?
March 08, 2005
Re: DMD 0.116 release
"John Demme" <me@teqdruid.com> wrote in message 
news:d0iujc$r3o$1@digitaldaemon.com...
> Matthew wrote:
>> "John Demme" <me@teqdruid.com> wrote in message 
>> news:d0itb3$pid$1@digitaldaemon.com...
>>
>>>Warnings? Whoa!  Walter, I know you didn't like the idea of warnings, 
>>>so thanks for at least giving it a try.  I'm sure we'll let you know 
>>>what we think.
>>>
>>>Let me preface myself by saying that I haven't been following the $ 
>>>or __FILE__ discussion (we've got waaay too much going on on this NG 
>>>nowadays) so I aplogize if I'm stepping on anyone's toes.
>>>
>>>As for $, __FILE__, and __LINE__...
>>>I think we (we of course meaning Walter) should make #<valid 
>>>identifier> a meta-keyword...  Then we replace length with $length, 
>>>__FILE__ with $file, ect... All other valid identifiers prefixed with 
>>>$ should be illegal...  This way, when one wants to add features such 
>>>as these, it will not break existing code, and will not necessitate 
>>>additional keywords. Perhaps there are even more uses for these 
>>>"meta-keywords" as well.
>>>
>>>Thoughts?
>>
>>
>> Don't like it.
>>
>> First: $ as a prefix may be getting a far more important and central 
>> role in the language.
> OK... show me what it is.  There are a few good symbols one could use: 
> #$%~, ect... Pretty much anything one uses instead of swearing would 
> do.
>
> Also, $arguments, and $argptr, are good for this.  I'm sure they'll be 
> more that might be appropriate.  I (obviously) like the idea of being 
> able to add small features to the language without breaking code. 
> This means that we'd be able to get convient features between 1.0 and 
> 2.0.

Well, I hate the _arguments stuff. Underscores are for
   - compiler extensions. This is expressely against the D philosphy, 
and DMD should never have them
   - irrepairable mistakes. D shouldn't have any of these prior to 1.0. 
(Although it's trying ...)

I don't know whether they can be made to fit the $xyz model, but my gut 
says they can (and should)

>
>>
>> Second: __FILE__ and __LINE__ are damn ugly, and that's a good thing. 
>> Making them less so might incline people to over/ab-use
>>
>> Third: __FILE__ and __LINE__ are standard parts of other languages, 
>> and widely recognised by most/all programmers.
>
> OK... how about $__FILE__ and $__LINE__? they're ugly now :) 
> Seriously, I don't buy it.  If a programmer's going to abuse 
> something, then it going to be abused.  If a programmer don't know 
> what abuse is, I'm not certain (s)he's gonna know what code beauty is 
> either.  But maybe I'm outta my gourd.

Well, there's no distinguishment between things that are part of the 
language proper, and things which are more compile-time 'facilities'.

$length, assuming that particular syntax is the goer, would be a 
regularly used facility. It's 'normal' code.

__DATE__, on the other hand, is a symbol that the compiler generates on 
our behalf, and would not anything but 'normal'. Nor would it 
manipulable. It's a context-dependent constant, I guess.

The two things are different, IMO, and should be represented as such.

In any case, you've not addressed the consistency issue. Even 
syntactically 'weird' languages such as Ruby still use __FILE__.

(Python uses __file__, but then source files are an 'active' part of 
Python, whereas in C/C++/D/Java/.NET they are the stuff that happens 
before the code becomes code.)
March 08, 2005
Re: DMD 0.116 release
1..length

Is that a range between 1 and a variable length, or between 1. and 
.length?

I suspect the latter won't compile, but I'm sure you get the point

"Andrew Fedoniouk" <news@terrainformatica.com> wrote in message 
news:d0iuko$r4p$1@digitaldaemon.com...
> Hmmmm....
>
> Can we just use "dot" for that?
>
> if( 0 != a.length && a[ .length - 1] == 10)
>
> []  brackets establish context (pretty much as 'with')
> a[.length-1] or
> a[.last]
>
> means as you said length of innermost array
>
> .arguments[] vector may also work.
>
>
>
>
>
>
>
>
>
> "Matthew" <admin@stlsoft.dot.dot.dot.dot.org> wrote in message 
> news:d0itm4$q26$1@digitaldaemon.com...
>>
>> "Walter" <newshound@digitalmars.com> wrote in message 
>> news:d0irlm$o0s$1@digitaldaemon.com...
>>> I'm not too sure about $, __FILE__ or __LINE__. There might be a 
>>> better way.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>
>> He he. I'm now inclining towards a more general approach to context 
>> dependency, following the $length, $count, etc. mentioned (by 
>> ??forgotten??; sorry) the other day.
>>
>> Simply put, $ would mean 'within the context of the innermost 
>> entity', so:
>>
>>
>>    int[]    a = . . .
>>
>>    if( 0 != a.length &&
>>        a[$length - 1] == 10)
>>    {
>>           ...
>>
>> Thus $ is not 'wasted' on array length, and neither $len nor $length 
>> (nor anything else) are defined as some special funky kinds of 
>> keywords. Rather, $X means that X is relative. Like a deeper/funkier 
>> with.
>>
>> I'll leave it to faster/sharper minds to come up with all the wild 
>> ramifications of this ...
>>
>>
>> :-)
>>
>>
>>
>
>
1 2 3 4 5 6
Top | Discussion index | About this forum | D home