"Stop Designing Languages. Write Libraries Instead."
rumbu
rumbu at rumbu.ro
Fri May 3 06:17:54 UTC 2019
On Friday, 3 May 2019 at 02:25:47 UTC, Mike Franklin wrote:
>
> I program mostly in C#, and I can build things quite quickly in
> it, not because it's a great language, but because of the .Net
> Framework and its huge list of class libraries. Take away the
> .Net Framework, and C# loses much of its appeal. I've often
> wanted to write a shim from D to the .Net class libraries just
> so I can use the .Net API from D. I think others might even
> currently be working on such a thing. What would be even
> better would be to write a tool that can automatically
> translate the .Net Framework class libraries to D, perhaps
> built on top of Phobos, to achieve platform abstraction.
Tried this [1], but there is a lot of stuff missing from Phobos
to replicate 1:1 the .Net Framework. From what I remember, these
were the challenges:
- culture sensitive string is a first class citizen of .net
framework. This involves Unicode comparisons, normalization and
all the ugly stuff you can find in std.uni;
- decimal data type is a built-in numeric type; I created my own
decimal implementation [2]
- the .net framework Console is a beast compared to the phobos
which simply calls the C library to write something on the screen
which results in a lot of problems (that you cannot use a
different decimal separator)
- again, culture sensitive info is missing from phobos (and I'm
not referring to strings here). You cannot have a decent calendar
or time zone information.
In fact the main problem is that .net classes are highly
interconnected, and you cannot jut write one class without
digging in another 1000. Just implementing a simple toString
functionality will lead to string management, which will lead to
unicode, which will lead to culture information for formatting
and so on...
[1] https://github.com/rumbu13/sharp/tree/master/src
[2] https://github.com/rumbu13/decimal/tree/master/src
More information about the Digitalmars-d
mailing list