dmd 1.057 and 2.041 release
Ary Borenszweig
ary at esperanto.org.ar
Mon Mar 8 06:11:11 PST 2010
Ary Borenszweig wrote:
> Walter Bright wrote:
>> Lots of meat and potatoes here, and a cookie! (spelling checker for
>> error messages)
>>
>> http://www.digitalmars.com/d/1.0/changelog.html
>> http://ftp.digitalmars.com/dmd.1.057.zip
>>
>>
>> http://www.digitalmars.com/d/2.0/changelog.html
>> http://ftp.digitalmars.com/dmd.2.041.zip
>>
>> Thanks to the many people who contributed to this update!
>
> bearophile must be very happy :-)
>
> - Add !in operator.
> - opCast(bool) and implicit call in if
>
> But I don't like this: "This only happens, however, for instances of
> structs. Class references are converted to bool by checking to see if
> the class reference is null or not."
>
> When I do:
>
> if (x) {
> }
>
> I'm normally interested to enter the if branch if x is not null and it
> has an interesting value. For example, if I implement a String class I
> would implement it as not being empty. But I think the biggest problem
> is making a different semantic for this to structs and classes. You'll
> have programmers wondering why the if branch was entered even if my
> class implemented opBool not to enter it. But time will tell.
>
> For opCast maybe it would be better to have some examples, like:
>
> T opCast(T)() if (is(T == bool)) {
> }
>
> T opCast(T)() if (is(T == int)) {
> }
>
> (it's not very intuitive that I have to do that to implement opCast,
> it's different from the other operator overloading that rely on strings)
>
> But very cool that opCast to many different types is implemented! :-)
And isn't it better for the spellchecker to show the closest match using
levenshtein distance instead of just distance 1?
More information about the Digitalmars-d-announce
mailing list