need clarification: will typedef, C struct initialization, etc.
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 2 09:21:49 PDT 2010
On 06/02/2010 10:21 AM, lurker wrote:
> Lionello Lunesu Wrote:
>
>> On 1-6-2010 5:38, Andrei Alexandrescu wrote:
>>> On 05/31/2010 03:54 PM, bearophile wrote:
>>>> Andrei Alexandrescu:
>>>>> typedef is gone.
>>>>
>>>> *mewls* I have shown here some examples of typedef usage, and
>>>> I'll keep posting few more in future. I'd like to pull it back
>>>> from the grave and keep it :-)
>>>
>>> It's wasted time. typedef is gone.
>>>
>>> Andrei
>>
>> :((
>>
>> I also miss typedef. I thought D had a great opportunity to fix
>> it.
>>
>> Take something like the Windows headers. It mostly consists of
>> typedefs for handles and whatnot. Without typedef you'd have to use
>> alias and type safety is out of the windows.
>>
>> So what would be the way to translate those Windows headers? Create
>> a unique struct for each old typedef? With alias this, and a ctor?
>> Well, if that's the way to do it now, why not make typedef a
>> shortcut for exactly that!?
>>
>> IIRC typedef is gone because you and Walter could not agree whether
>> it had to be a subtype or a supertype of the typedef'ed type. For
>> me it's rather simple: I want to introduce a new type in such a way
>> that it helps me prevent mistakes, ie. passing one handle when the
>> function wants another, even though both are based on void*, or
>> whatever.
>>
>> Bring typedef back!
>
> You're apparently missing something. The D 2.0+ has and will be
> designed by real group of experts who have "garnered a solid
> reputation as a leading innovator in programming languages and
> methods", i.e. Walther and Android. They have huge experience
> designing the leading programming languages such as Haskell, F#,
> Spec#, Java7, C#4, Erlang, Discipline, Python3, XML, Go etc.
>
> The decade of community inspired D has already ended. There's too
> much momentum behind the current design decisions to change that now.
> The future spec will be "casual and conversational, but never at the
> expense of focus and precision".
>
> You're only wasting your time if you wish D to change. It won't. D is
> focusing on commercial multicore real world applications now. That's
> happens by using Phobos& D2. Your previous bugs are magically gone.
> We need stability, we don't need new features. Most importantly, we
> don't need no experimental features - especially if your proposal
> comes from a competing language with a simpler syntax and more
> rigorously presented semantics.
Tasteful irony (gave me a good chuckle), but unfortunately it's misplaced.
I suggested eliminating typedef exactly because it was ill-defined and
it was lacking rigorous semantics. Walter agreed to eliminating it
exactly because he was unable to ground typedef's definition. Also,
progress in other, better-defined areas of the language afford us to
implement typedef as a user-defined abstraction.
There are other things to be snarky about regarding D - have at them!
Andrei
More information about the Digitalmars-d
mailing list