December 08, 2009
retard wrote:
> Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote:
> 
>> Andrei Alexandrescu Wrote:
>>
>>>> What will removing it gain you?
>>> Sancta simplicitas.
>> Hm.. I don't really buy that argument.
>>
>> I see you and Walter removing/witholding things (incomparability
>> operators, logical operator overloading) from the language, because: "I
>> can't imagine a use for it and removing it makes the language simpler."
>>
>> Meanwhile, you're keeping C syntax for function-pointers around, and I'm
>> missing syntactic sugar for my tribool.
> 
> You probably don't want to anger millions of users coming from the C community, do you?

While we're at it, lets avoid angering the millions of users coming from the Java community. And the Python community. And the PHP community. And the...
December 08, 2009
Walter Bright wrote:
> Simen kjaeraas wrote:
>> Leave it in. WIth unary -, we should also have its archnemesis, the unary +.
> 
> Can't have Superman without Lex Luthor!

Well, you can, but the stories would be a good bit less interesting.
December 08, 2009
On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:

> Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across positive and negated uses, easy to understand, easy to define, consistent with built-in types, and Walter likes it.

I'm not sure that's a great idea. What if you define your own FuzzyBool type (containing some sort of probability) and FuzzyBool.opUnary!("!") returns an inverted FuzzyBool (with 1 - original probability) instead of a regular bool, you'd have an infinite loop trying to evaluate !!myBoolValue.

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/

December 08, 2009
Michel Fortin wrote:
> On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:
> 
>> Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across positive and negated uses, easy to understand, easy to define, consistent with built-in types, and Walter likes it.
> 
> I'm not sure that's a great idea. What if you define your own FuzzyBool type (containing some sort of probability) and FuzzyBool.opUnary!("!") returns an inverted FuzzyBool (with 1 - original probability) instead of a regular bool, you'd have an infinite loop trying to evaluate !!myBoolValue.

Yeah, I thought about that liability and decided to discount it as a design mistake of the user. If a type decides to return non-bool from "!", they are bound to unpleasantly surprise its user in more ways than one. You can define a negate for FuzzyBool - just don't dress it as the "!" operator.

Andrei
December 08, 2009
Tue, 08 Dec 2009 12:08:43 +0900, Mike Parker wrote:

> retard wrote:
>> Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote:
>> 
>>> Andrei Alexandrescu Wrote:
>>>
>>>>> What will removing it gain you?
>>>> Sancta simplicitas.
>>> Hm.. I don't really buy that argument.
>>>
>>> I see you and Walter removing/witholding things (incomparability operators, logical operator overloading) from the language, because: "I can't imagine a use for it and removing it makes the language simpler."
>>>
>>> Meanwhile, you're keeping C syntax for function-pointers around, and I'm missing syntactic sugar for my tribool.
>> 
>> You probably don't want to anger millions of users coming from the C community, do you?
> 
> While we're at it, lets avoid angering the millions of users coming from the Java community. And the Python community. And the PHP community. And the...

That's just silly. D has its C roots. Python and PHP are rivaling amateur languages. A scripting language user wouldn't use D, but all C users should switch to D because the execution model is similar and C is basically a subset of D.
December 08, 2009
retard wrote:
> Tue, 08 Dec 2009 12:08:43 +0900, Mike Parker wrote:
> 
>> retard wrote:
>>> Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote:
>>>
>>>> Andrei Alexandrescu Wrote:
>>>>
>>>>>> What will removing it gain you?
>>>>> Sancta simplicitas.
>>>> Hm.. I don't really buy that argument.
>>>>
>>>> I see you and Walter removing/witholding things (incomparability
>>>> operators, logical operator overloading) from the language, because:
>>>> "I can't imagine a use for it and removing it makes the language
>>>> simpler."
>>>>
>>>> Meanwhile, you're keeping C syntax for function-pointers around, and
>>>> I'm missing syntactic sugar for my tribool.
>>> You probably don't want to anger millions of users coming from the C
>>> community, do you?
>> While we're at it, lets avoid angering the millions of users coming from
>> the Java community. And the Python community. And the PHP community. And
>> the...
> 
> That's just silly. D has its C roots. Python and PHP are rivaling amateur languages. A scripting language user wouldn't use D, but all C users should switch to D because the execution model is similar and C is basically a subset of D.

My point is that there's no reason to cater to any one particular group of programmers. We all have to learn new syntax when moving between languages, and we all have different backgrounds. There are numerous members of the D community with plenty of Java, but little or no C, experience. C syntax doesn't help them one bit.

D is *not* C, no matter its roots. And D2 is farther from C than D1. There's no reason to keep around an alternative C syntax for a particular feature (like function pointers) when everyone recommends the /D style/ syntax be preferred. I think C programmers are smart enough to figure things out without the language keeping around old syntax. If they want C, they can stick with C.
December 08, 2009
On 2009-12-07 23:52:04 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:

> Michel Fortin wrote:
>> On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:
>> 
>>> Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across positive and negated uses, easy to understand, easy to define, consistent with built-in types, and Walter likes it.
>> 
>> I'm not sure that's a great idea. What if you define your own FuzzyBool type (containing some sort of probability) and FuzzyBool.opUnary!("!") returns an inverted FuzzyBool (with 1 - original probability) instead of a regular bool, you'd have an infinite loop trying to evaluate !!myBoolValue.
> 
> Yeah, I thought about that liability and decided to discount it as a design mistake of the user. If a type decides to return non-bool from "!", they are bound to unpleasantly surprise its user in more ways than one. You can define a negate for FuzzyBool - just don't dress it as the "!" operator.

To me, its using "!" to transform something to a bool that looks like a hack. Surely there's a more explicit and intuitive way to define it that doesn't tie it to a specific operator.

opTest perhaps?

And if you think "!" should always return a bool, then it should just not be overridable and should be defined as returning the negation of opTest (or whatever the name). I don't feel restricting unary "!" to return a bool is sound when all other unary ops can be defined to return anything.

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/

December 08, 2009
On Tue, 08 Dec 2009 16:40:20 +0300, Michel Fortin <michel.fortin@michelf.com> wrote:

> On 2009-12-07 23:52:04 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:
>
>> Michel Fortin wrote:
>>> On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> said:
>>>
>>>> Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across positive and negated uses, easy to understand, easy to define, consistent with built-in types, and Walter likes it.
>>>  I'm not sure that's a great idea. What if you define your own FuzzyBool type (containing some sort of probability) and FuzzyBool.opUnary!("!") returns an inverted FuzzyBool (with 1 - original probability) instead of a regular bool, you'd have an infinite loop trying to evaluate !!myBoolValue.
>>  Yeah, I thought about that liability and decided to discount it as a design mistake of the user. If a type decides to return non-bool from "!", they are bound to unpleasantly surprise its user in more ways than one. You can define a negate for FuzzyBool - just don't dress it as the "!" operator.
>
> To me, its using "!" to transform something to a bool that looks like a hack. Surely there's a more explicit and intuitive way to define it that doesn't tie it to a specific operator.
>
> opTest perhaps?
>
> And if you think "!" should always return a bool, then it should just not be overridable and should be defined as returning the negation of opTest (or whatever the name). I don't feel restricting unary "!" to return a bool is sound when all other unary ops can be defined to return anything.
>

You don't have to, but then you'll lose an ability to use UDT in if clause :P
December 08, 2009
Mike Parker wrote:
> […] I think C programmers are smart enough to figure things out without the language keeping around old syntax. If they want C, they can stick with C.

I think so too – the »new«, D function pointer syntax is much more readable and intuitive than the C one which is widely regarded as being quite messy, especially in more complex declarations.

Please do not even start to think about removing elements with valid use- cases (even if there were hardly any) in the name of reducing language complexity (note aside: I do not really see how one more unary operator could really make a difference here) before removing redundancies…
December 08, 2009
On Dec 8, 09 19:11, retard wrote:
> Tue, 08 Dec 2009 12:08:43 +0900, Mike Parker wrote:
>
>> retard wrote:
>>> Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote:
>>>
>>>> Andrei Alexandrescu Wrote:
>>>>
>>>>>> What will removing it gain you?
>>>>> Sancta simplicitas.
>>>> Hm.. I don't really buy that argument.
>>>>
>>>> I see you and Walter removing/witholding things (incomparability
>>>> operators, logical operator overloading) from the language, because:
>>>> "I can't imagine a use for it and removing it makes the language
>>>> simpler."
>>>>
>>>> Meanwhile, you're keeping C syntax for function-pointers around, and
>>>> I'm missing syntactic sugar for my tribool.
>>>
>>> You probably don't want to anger millions of users coming from the C
>>> community, do you?
>>
>> While we're at it, lets avoid angering the millions of users coming from
>> the Java community. And the Python community. And the PHP community. And
>> the...
>
> That's just silly. D has its C roots. Python and PHP are rivaling amateur
> languages. A scripting language user wouldn't use D, but all C users
> should switch to D because the execution model is similar and C is
> basically a subset of D.

All C users should switch to D when D can be used without the GC with little effort.