February 25, 2004
J C Calvarese wrote:
> J Anderson wrote:
> 
>> J C Calvarese wrote:
>>
>>> J Anderson wrote:
>>>
>>> I think it'd be impossible to grep, but at least the compiler error messages should point to the code that needs correcting. I'm not sure if it needs changing, but if something this fundamental is going to be changed, now is our opportunity to make the change. Pretty soon, the door will close on that chance.
>>>
>>> D 1.0 hasn't arrived yet, and I don't think we'd be able to make a change here once it does arrive.
>>
>>
>> With my other hat:
>>
>> It is something I like from C++ with all warnings (maximum level) as errors set.  Actually I think that just about all c++ warnings (maximum level) should become errors in D.
> 
> 
> If Walter doesn't see these implicit casts as a problem, it's possible 

Walter wrote:
> I've changed the language so that floating point values are no longer
> implicitly converted to integral types.

... in thread "[Language design] yet another notational error"

Walter, does this mean you'll disallow implicit casts to lesser-space in all cases (ie uints/ints etc etc etc)?

Please? ;)

Cheers,
Sigbjørn Lund Olsen
February 25, 2004
J C Calvarese wrote:

[...]
> Output:
> -2000000000 // expected
> -1000000000 // somewhat expected
> 2294967296  // nonsense
> 3294967296  // nonsense

Not confirmed.

My output:
-2000000000
-1000000000
-2000000000
-1000000000

And the output you got is in no means nonsense, because it is the `uint' interpretation of the specified negative `int' values.

What you have to do is to check whether the actual value is in the range of the target type, if you do not already know, that it is in this range.

But when done checking, why should the language force you, to now declare that you are really, really shure that you want to cast by requiring an explicit cast?

  int i;
  uint j;
  ...
  if(uint.min <= i && i <= uint.max)j= cast(uint) i; // ?
    else throw ....

So long.




February 25, 2004
On Wed, 25 Feb 2004 15:18:05 +0100 (02/26/04 01:18:05)
, Sigbjørn Lund Olsen <sigbjorn@lundolsen.net> wrote:

>>> J C Calvarese wrote:
[snip]
>> If Walter doesn't see these implicit casts as a problem, it's possible
>
> Walter wrote:
>  > I've changed the language so that floating point values are no longer
>  > implicitly converted to integral types.
>
> ... in thread "[Language design] yet another notational error"
>
> Walter, does this mean you'll disallow implicit casts to lesser-space in all cases (ie uints/ints etc etc etc)?
>

If implicit casting is not an error and cannot be a despicable warning, would it still be useful as an 'informational' message. In my case, I'd like to know where all cases of D doing this occurs so that I can either change datatypes or make the cast explicit, or even something else. Its not always obvious to the human eye where such implicit casts exist.

-- 
Derek
February 25, 2004
Manfred Nowak wrote:
> J C Calvarese wrote:
> 
> [...]
> 
>>Output:
>>-2000000000 // expected
>>-1000000000 // somewhat expected
>>2294967296  // nonsense
>>3294967296  // nonsense
> 
> 
> Not confirmed.
> 
> My output:
> -2000000000
> -1000000000
> -2000000000
> -1000000000

Oops. I meant to use this code in my example:

void printUint(uint u)
{
	printf("%u\n", u);  /* d => u */
}

Thanks for straightening me out.

> 
> And the output you got is in no means nonsense, because it is the `uint'
> interpretation of the specified negative `int' values.

OK, I exaggerated. My example is admittedly contrived, but the lack of any compiler errors is still unassuring.

> What you have to do is to check whether the actual value is in the range
> of the target type, if you do not already know, that it is in this range.
> 
> But when done checking, why should the language force you, to now declare
> that you are really, really shure that you want to cast by requiring an
> explicit cast?
> 
>   int i;
>   uint j;
>   ...
>   if(uint.min <= i && i <= uint.max)j= cast(uint) i; // ?
>     else throw ....
> 
> So long.

Not that long ago, I would have argued in favor of all sorts of implicit casting, but now I think that I was way wrong. I'm just not sure how far I should argue to the other extreme.


-- 
Justin
http://jcc_7.tripod.com/d/
February 25, 2004
Derek Parnell wrote:
[...]
> 
> If implicit casting is not an error and cannot be a despicable warning, would it still be useful as an 'informational' message. In my case, I'd like to know where all cases of D doing this occurs so that I can either change datatypes or make the cast explicit, or even something else. Its not always obvious to the human eye where such implicit casts exist.
> 

Your description of an "informational" message sounds eerily similar to what I thought a "warning" message was. :)

-- 
Justin
http://jcc_7.tripod.com/d/
February 25, 2004
On Wed, 25 Feb 2004 17:35:16 -0600 (02/26/04 10:35:16)
, J C Calvarese <jcc7@cox.net> wrote:

> Derek Parnell wrote:
> [...]
>>
>> If implicit casting is not an error and cannot be a despicable warning, would it still be useful as an 'informational' message. In my case, I'd like to know where all cases of D doing this occurs so that I can either change datatypes or make the cast explicit, or even something else. Its not always obvious to the human eye where such implicit casts exist.
>>
>
> Your description of an "informational" message sounds eerily similar to what I thought a "warning" message was. :)
>

Yah think ? ;-)

-- 
Derek
February 28, 2004
J Anderson wrote:
> ...
> and to be able to program more with less checking intervals.  It's
> like spell checking, when typing you don't spell check till after
> you've finished (Yes. I'm still guilty of checking every paragraph
> rather then the entire document at the end). If you stop at every
> spelling mistake, you can't go as fast.  Then you re-read it and
> make sure the draft you've typed is correct.
> ...

Humbly (sp?), I can say I don't make spelling mistakes in Spanish. But every time I doubt about a word, I check how I wrote it. Now, that happens in about one or two words each page. If that's too when programming, then when someone really masters programming, s/he would write hundreds of lines of code and just stops to check one line here or there? Eventually could go as far as doing an entire module just compiling at the end? I'd like to know if there's someone who can really do that.

-----------------------
Carlos Santander Bernal


February 28, 2004
Carlos Santander B. wrote:

>J Anderson wrote:
>  
>
>>...
>>and to be able to program more with less checking intervals.  It's
>>like spell checking, when typing you don't spell check till after
>>you've finished (Yes. I'm still guilty of checking every paragraph
>>rather then the entire document at the end). If you stop at every
>>spelling mistake, you can't go as fast.  Then you re-read it and
>>make sure the draft you've typed is correct.
>>...
>>    
>>
>
>Humbly (sp?), I can say I don't make spelling mistakes in Spanish. But every
>time I doubt about a word, I check how I wrote it. Now, that happens in
>about one or two words each page. If that's too when programming, then when
>someone really masters programming, s/he would write hundreds of lines of
>code and just stops to check one line here or there? 
>
>  
>
Generally I use something like rational rose (C++) to build the module, then I just need to fill in the blanks.  Things like getters/setters are easily filled in without any checking.  The real meat is the difficult (which is a relative term) algorithms. Often I just write out what I'm going to do in comment form then fill in all the blanks, this includes any sub-routines.  Once that's done then I compile (and might-run if there's no mistake).  These algorithms are usually a couple of 100 lines.  Of course the algorithms generally aren't fully semanticly correct, but because the entire algorithm is there I can see the bigger picture in my head better.

My period between running and testing the algorithms can be much longer then the syntactical correction, particularly because many of my algorithm require a couple of minutes (or hours) to run.

But that's just my style, you might find something else works for you.

>Eventually could go as
>far as doing an entire module just compiling at the end? I'd like to know if
>there's someone who can really do that.
>
Personally, I wouldn't go that far. I would work on a theme in the module and get that working before checking. I would only do as much as I can comprehend and only in one sitting.  Sometimes that means compiling after a few lines but more generally a few hundred.  I generally try to make sure everything is working (that I was working) before I leave a sit-in because I know if I go away I'll forget something.

>-----------------------
>Carlos Santander Bernal
>  
>
-- 
-Anderson: http://badmama.com.au/~anderson/
1 2 3 4 5
Next ›   Last »