Talk on what a systems programming language needs to replace C
russel at winder.org.uk
Thu Sep 5 10:15:24 UTC 2019
On Thu, 2019-09-05 at 00:32 +0000, Laeeth Isharc via Digitalmars-d wrote:
> I don't see how allowing creating D AST via a library presents a
> serious risk though.
There are certainly risks, but either you assume all programmers are evil and
must be protected by the language designer from making errors the language
designer doesn't like, or you assume a community of sensible programmers who
work together to make the best of potentially dangerous features.
Groovy took the latter view and the community pulled together and even
produced some totally unexpected by totally wonderful features.
The general history of programming languages does tend to be the knowledgeable
authority kindly protecting programmers from trying to do bad (in the eyes of
the authority) things.
The history of programming is the history of trying to protect programmers
from doing things.
> And I wonder a bit about DSLs. I agree with you about not
> abusing operator overloading. You should make it an explicit DSL
Internal or external DSLs. For internal DSLs (my experience is Python and
Groovy) then operator overloading is essential to make any sensible progress.
Also, perhaps bizarrely, using an object oriented view of program execution
(i.e. messages passed to receivers) helps a great deal.
> But then the answer ought to be that there are libraries that
> make it easy to develop DSLs.
> The competition is quite stiff. There are frameworks that build
> editor plugins with syntax highlighting etc all in an integrated
> In some ways D is peculiarly suited to writing DSLs. It's not
> difficult to write a parser but having Pegged can make the
> difference between an unrealistic project and just about being
> able to accomplish something. The type marshalling capabilities
> makes the standard library easy.
External DSLs maybe but not internal DSLs.
> But I guess if you compare to what's easy with LINQ and Rosslyn
> there is something missing. It's not trivial to hook up the AST
> of your DSL to LLVM or similar. Not difficult but it's not no
> work if you don't already know it.
> What's your take on Rust macros? I am not familiar with them so
> I don't know myself.
I have only dabbled a little, but they are quite good. And fully typed
checked. I am sure you can do nasty things with them, but for the simple cases
I have used them for they do the job as needed.
Dr Russel Winder t: +44 20 7585 2200
41 Buckmaster Road m: +44 7770 465 077
London SW11 1EN, UK w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: This is a digitally signed message part
More information about the Digitalmars-d