March 08, 2005
Walter wrote:
> I'm not too sure about $, __FILE__ or __LINE__. There might be a better way.
> 
> http://www.digitalmars.com/d/changelog.html

"warning - array 'length' hides other 'length' name in outer scope"
...
"The warning can be resolved by:

   1. Renaming the outer length to another name.
   2. Replacing the use of length within the [ ] with a.length.
   3. If length is at global or class scope, and that was the one intended to be used, use .length or this.length to disambiguate.

Some proposed language solutions are:

   1. Make the length a special symbol or a keyword instead of an implicitly declared variable."

You've just added the $ notation, yet you haven't mentioned it here. Simply because it's a trial feature, and the page might end up out of date if you decide to get rid of it?

And IMM making length a keyword wouldn't be the Right Thing - we'd lose the ability to use this name for a property in container classes.

"Fixed D.bugs/1849"

Excellent!

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
March 08, 2005
I think this is a bug:

//-----------------------------------------------
int bar() { return 0; }
bool foo() { return bar()==0; }
void main() {}
//-----------------------------------------------

warning - test.d(2): implicit conversion of expression (bar == 0) of
type int to bit can cause loss of data

Same happens if bar is instead a variable, but not if it's a constant.

Notice, however, that this doesn't produce any warning:

int foo() { return null?0:1; }

But this does:

bool foo() { return null; }

_______________________
Carlos Santander Bernal


March 08, 2005
> I'm not too sure about $

Oh, Christ Almighty.  Coming from a basic background, this is going to look confusing.  Strings everywhere.


March 08, 2005
Jarrett Billingsley wrote:
>>I'm not too sure about $
> 
> 
> Oh, Christ Almighty.  Coming from a basic background, this is going to look confusing.  Strings everywhere. 
> 
> 

He is indeed. Please don't resort to profanity.
March 08, 2005
We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;)

"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:d0l3vf$b52$1@digitaldaemon.com...
>> I'm not too sure about $
>
> Oh, Christ Almighty.  Coming from a basic background, this is going to look confusing.  Strings everywhere.
> 


March 08, 2005
Matthew wrote:
> We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;)
> 
> "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:d0l3vf$b52$1@digitaldaemon.com...
> 
>>>I'm not too sure about $
>>
>>Oh, Christ Almighty.  Coming from a basic background, this is going to look confusing.  Strings everywhere.
>>
> 
> 
> 


Bobdamnit!
March 09, 2005
"Matthew" <admin@stlsoft.dot.dot.dot.dot.org> skrev i en meddelelse news:d0iv6c$rp8$2@digitaldaemon.com...
> $length, assuming that particular syntax is the goer, would be a regularly used facility. It's 'normal' code.

And people coming from BASIC would think that it is a string :-)

Regards,
Martin


March 09, 2005
Walter wrote:

> http://www.digitalmars.com/d/changelog.html

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

> Bugs Fixed:

> #  Fixed D.gnu/983 bug
http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/983
a.k.a. "OS X bug: universal alpha identifiers"

> Programs with non-ascii identifiers do not
> link, under Mac OS X 10.3 using GDC 0.10...
> 
> They use the mangled name as a label for
> the assembler, and then choke on the UTF-8

Great, now I can start using all weirdo names! :-)
http://www.algonet.se/~afb/d/universalalphas/

Well, when GDC catches up with DMD again that is...
(currently gdc 0.10 is at dmd 0.110, feature-wise)

--anders
March 09, 2005
"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.
>

Using "dot" like that is already the global scope resolution operator.


> "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 09, 2005
> We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;)

Oh, Bob Almighty then.


1 2 3 4 5 6
Next ›   Last »