www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Create a new language ?

reply Alain De Vos <devosalain ymail.com> writes:
Why not create a new language.

A language from scratch.
With syntactic sugar as needed.
But where the language compiles to a simple dlang .d file.
Which you compile to an executable using ldc2.

Now features are available as libraries but it leads to "ugly 
code" as reader of code.
And there are multiple ways of doing the same thing which means 
the reader of code has to know all the ways. Enforce one way.

Feel free to elaborate.
Nov 06 2023
parent reply Sergey <kornburn yandex.ru> writes:
On Monday, 6 November 2023 at 20:00:51 UTC, Alain De Vos wrote:
 Why not create a new language.

 A language from scratch.
 With syntactic sugar as needed.
 But where the language compiles to a simple dlang .d file.
 Which you compile to an executable using ldc2.

 Now features are available as libraries but it leads to "ugly 
 code" as reader of code.
 And there are multiple ways of doing the same thing which means 
 the reader of code has to know all the ways. Enforce one way.

 Feel free to elaborate.
What is the reason to use D as a backend? Usually people using C or LLVM. you will be interested in https://www.roc-lang.org - very young language and WIP. You can participate in development.
Nov 06 2023
parent reply Alain De Vos <devosalain ymail.coom> writes:
Except for dotnet or java , i use freebsd alot.
Already a problem for roc.
No idea how to make roc work on freebsd ? Even if i have a 
clang-llvm & gcc toolchain.
Compare, with scala-native i can compile very easy to 
self-contained-executables on freebsd...

Why d-lang ?
Why not d-lang ?
Example.
https://www.smlnj.org/
Not bad as language, but i can't bind to any external library. 
It's pure academic.

Dlang. Why not build on what already exists ? Functional came 
afterwards, after object oriented.
Even if it is implemented in a library, "an sich", not 
necessarily bad idea.
If it works it's ok. But it's currently ugly.
Nov 06 2023
parent reply Alain De Vos <devosalain ymail.com> writes:
simple example :

In invented programming language you write :

x |> y |> z

Translates towards dlang :

functional_pipeline_from_left_to_right(x,y,z)

I.e. pipe! in std.functional.
Nov 06 2023
parent Alain De Vos <devosalain ymail.com> writes:
or

type Temperature = Fahrenheit | Celsius | Kelvin

translates to :

std.sumtype
->
alias Temperature = SumType!(Fahrenheit, Celsius, Kelvin);
Nov 06 2023