Walter, I need a __trait please.

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 16 04:45:28 PDT 2016


On Tuesday, 15 March 2016 at 23:04:59 UTC, deadalnix wrote:
> On Tuesday, 15 March 2016 at 19:59:01 UTC, deadalnix wrote:
>> On Tuesday, 15 March 2016 at 11:47:20 UTC, ZombineDev wrote:
>>> Instead I think that if we improve D's existing introspection 
>>> capabilities and expose the compiler as a library at 
>>> compile-time, we will have a much powerful system than any 
>>> potential macro system, for a fraction of the complexity.
>>>
>>> These videos are what changed my mind:
>>> 1. https://www.youtube.com/watch?v=OHZwYYW9koI
>>> 2. https://www.youtube.com/watch?v=59lKAlb6cRg
>>> (Jonathan Blow's programming language for games)
>>
>> It is like one of these simili good idea that everybody tries 
>> and everybody regrets it. You DON'T want to expose your 
>> compiler implementation to the language.
>>
>> Jonathan Blow is certainly a talented person, but he has a 
>> very grave NIH syndrome and various blind spot in language 
>> design.
>
> So, to give a concrete example, because my critic sounds free 
> and mean.
>
> https://youtu.be/59lKAlb6cRg?t=28m24s
>
> He quote C++ and D while presenting the defers feature. Turns 
> out this feature is the same thing as scope(exit) and is 
> planned to be added to C++ at some point.
>
> The more general subject of the video is basically AOP. For the 
> most part, is is a clumsy implementation of something like 
> lombok: https://projectlombok.org/
>
> In addition it exposes the compiler, which will create 
> maintenance problems in the future.

Yes, I know about AOP, but this is just a single application of 
all the possible use cases of his idea. Another example is 
describing the build process of your project with the same 
language, in the same source file. I'm sure there are many other 
possible use cases.
Of course this can be easily abused, but it doesn't seem 
difficult to use it appropriately either. "With great power, 
comes great responsibility." It looks clumsy because it is 
low-level. Surely you can built higher level functionality that 
is nice and easy to use.

"You DON'T want to expose your compiler implementation to the 
language."
ironically, it looks like there is a company whose business is 
solely based on this idea 
(https://www.postsharp.net/aop.net/compiletime-weaving) and it 
looks like they are quite successful 
(https://www.postsharp.net/). The list of features 
(https://www.postsharp.net/features) proves that more access is 
better than no access, because otherwise none of them would be 
possible.


More information about the Digitalmars-d mailing list