View mode: basic / threaded / horizontal-split · Log in · Help
March 08, 2005
Re: Mango and -w (was DMD 0.116 release)
"Kris" <Kris_member@pathlink.com> wrote in message
news:d0j2gi$vfp$1@digitaldaemon.com...
> Warning messages with Mango:
>
>
> #  char[] get (char[] name)
> #  {
> #      if (name in dictionary)
> #          return dictionary[name];
> #      return null;
> #  }
>
> the above produces a "statement not reachable" message for the null
return. I
> think you'd agree that the statement most certainly should be reachable?

Yes. That looks like a bug. I'll fix it.
March 08, 2005
Re: DMD 0.116 release
> 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 ...

you mean like what $EX would return? hmm...
March 08, 2005
Re: Mango and -w (was DMD 0.116 release)
In article <d0j5nd$13fd$1@digitaldaemon.com>, clayasaurus says...
>
>Kris wrote:
>> Warning messages with Mango:
>> 
>> 
>> #  char[] get (char[] name)
>> #  {
>> #      if (name in dictionary)
>> #          return dictionary[name];
>> #      return null;
>> #  }
>> 
>> the above produces a "statement not reachable" message for the null return. I
>> think you'd agree that the statement most certainly should be reachable?
>> 
>
>humm... i'm not 100% but i think the reason it is not reachable is 
>because if the 'if statement' is true then the 'return null' will be the 
>'dead code'
>
>simple fix would be...
>
>if (name in dictionary)
>    return dictionary[name];
>else
>    return null;
>
>unless i'm just not understanding your point... :-/

It would only be dead-code if it were in a combined block with the other return
(would be vaguely amusing if the 'else' actually did make a difference :-)  

Nay ~ I think it's just a case of a bug in the message-production instead.
There's plenty other false-positives to back that assertion.
March 08, 2005
Re: DMD 0.116 release
David Medlock wrote:
> Walter wrote:
> 
>> I'm not too sure about $, __FILE__ or __LINE__. There might be a 
>> better way.
>>
>> http://www.digitalmars.com/d/changelog.html
>>
> 
> Why not just make with() apply to arrays as well?
> 
> Cleaner, imo.
> 
> with(a) x[0..length] = a[0..length];
> 

Ewwie... Confusing... the first time I looked at that I thought, "but 
what if x and a are different sizes?" Then I re-read it.
March 08, 2005
Re: Mango and -w (was DMD 0.116 release)
On Mon, 7 Mar 2005 19:49:56 -0800, Walter wrote:

> "Kris" <Kris_member@pathlink.com> wrote in message
> news:d0j2gi$vfp$1@digitaldaemon.com...
>> Warning messages with Mango:
>>
>>
>> #  char[] get (char[] name)
>> #  {
>> #      if (name in dictionary)
>> #          return dictionary[name];
>> #      return null;
>> #  }
>>
>> the above produces a "statement not reachable" message for the null
> return. I
>> think you'd agree that the statement most certainly should be reachable?
> 
> Yes. That looks like a bug. I'll fix it.

Great! I just had about 50 of these to get around.

-- 
Derek
Melbourne, Australia
8/03/2005 3:09:33 PM
March 08, 2005
Re: DMD 0.116 release
> Why not just make with() apply to arrays as well?
>
> Cleaner, imo.
>
> with(a) x[0..length] = a[0..length];

What about where you've got more than array involved in the statement?
March 08, 2005
Re: DMD 0.116 release
Matthew wrote:

>>Why not just make with() apply to arrays as well?
>>
>>Cleaner, imo.
>>
>>with(a) x[0..length] = a[0..length];
> 
> 
> What about where you've got more than array involved in the statement?
> 
> 
> 

with(a) x[0..length] = a[0..length];
^^^^^^^
March 08, 2005
Re: Mango and -w (was DMD 0.116 release)
Thanks. 

Right now, the compiler halts after emiting a few warnings ... can you perhaps
make it continue until it hits some errors (or runs out of files), please?



In article <d0j7qe$15t6$1@digitaldaemon.com>, Walter says...
>
>
>"Kris" <Kris_member@pathlink.com> wrote in message
>news:d0j2gi$vfp$1@digitaldaemon.com...
>> Warning messages with Mango:
>>
>>
>> #  char[] get (char[] name)
>> #  {
>> #      if (name in dictionary)
>> #          return dictionary[name];
>> #      return null;
>> #  }
>>
>> the above produces a "statement not reachable" message for the null
>return. I
>> think you'd agree that the statement most certainly should be reachable?
>
>Yes. That looks like a bug. I'll fix it.
>
>
March 08, 2005
Re: DMD 0.116 release
"David Medlock" <amedlock@nospam.com> wrote in message 
news:d0j92e$1706$1@digitaldaemon.com...
> Matthew wrote:
>
>>>Why not just make with() apply to arrays as well?
>>>
>>>Cleaner, imo.
>>>
>>>with(a) x[0..length] = a[0..length];
>>
>>
>> What about where you've got more than array involved in the 
>> statement?
>>
>>
>>
>
> with(a) x[0..length] = a[0..length];
> ^^^^^^^

Sorry, my mistake.

So what does the above code do? It'd confuse the shit out of me even 
were it legal.
March 08, 2005
Re: DMD 0.116 release
Matthew wrote:

> "David Medlock" <amedlock@nospam.com> wrote in message 
> news:d0j92e$1706$1@digitaldaemon.com...
> 
>>Matthew wrote:
>>
>>
>>>>Why not just make with() apply to arrays as well?
>>>>
>>>>Cleaner, imo.
>>>>
>>>>with(a) x[0..length] = a[0..length];
>>>
>>>
>>>What about where you've got more than array involved in the 
>>>statement?
>>>
>>>
>>>
>>
>>with(a) x[0..length] = a[0..length];
>>^^^^^^^
> 
> 
> Sorry, my mistake.
> 
> So what does the above code do? It'd confuse the shit out of me even 
> were it legal.
> 
> 
> 

With broadens a search for scoped variables. So when the compiler tries 
to figure out what length is, it checks with block, then local scope, etc.

Its standard in pascal, although I dont know why walter only allows one 
item in there.  Its a nice timesaver and underrated, imo.
1 2 3 4 5 6
Top | Discussion index | About this forum | D home