Worse is better?
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 13 04:07:38 PDT 2014
On Friday, 10 October 2014 at 21:54:32 UTC, Peter Alexander wrote:
> On Friday, 10 October 2014 at 21:11:20 UTC, Ola Fosheim Grostad
> wrote:
>> On Friday, 10 October 2014 at 09:00:17 UTC, Peter Alexander
>> wrote:
>>> You can't have simple, expressive, and low level control.
>>
>> Why not?
>
> It's just something I believe from experience.
Ok, beliefs are good, but one should not limit visions by them.
> The gist of my reasoning is that to get low level control you
> need to specify things. When those things are local and
> isolated, all is good, but often the things you specify bleed
> across interfaces and affect either all the implementations
> (making things more complex) or all the users (making things
> less expressive).
I don't think there is anything that prevents a language from:
1. Allow the user to specify the constraints and let the system
fill in the details.
2. Let the user guide the search down to the low level details
for efficiency.
So, from a theoretical point of view I'd say it should be
possible to go from high to low level with a reasonable simple
language at the cost of an advanced compiler.
If you can specify how a program should work and let a human
being construct a program from it that works from the
specification alone, then a "competent" compiler/expert system
should be able to do the same thing.
> For example, consider the current memory allocation/management
> debate. I cannot think of a possible way to handle this that
> simultaneously:
>
> (a) gives users full control over how every function
> allocates/manages memory (control).
> (b) makes the implementation of those functions easy (simple).
> (c) makes it easy to compose functions with different
> management policies (expressive).
I think the compiler should handle memory management and let the
user configure the compiler.
It is rather obvious that the compiler sometimes should to
instantiate two different versions of the same function based on
usage on the call site, so if you don't let the compiler handle
this then achieving the optimization potential becomes difficult.
Another point: compiling code to run on allocated activation
records is not the same as having it compile for a call-stack. If
you want lots of fibers you have to give up the concept of a
stack and stick to activation records. It is also a more generic
concept (Simula used it to represent both objects and memory
function blocks, they had the same internal representation).
> Maybe there's a way to do it, but if there is I imagine that
> language and programming experience is going to be vastly
> different from what we have now (in any language).
Probably. So if you are going to support low level programming
then it is better to focus on the low level and be a bit more
reluctant to add high level features.
From a system level language I don't really need:
- templates
- exceptions
- fibers
- garbage collection
I'd rather have basic building blocks and some kind of well
designed deductive capability. Type systems are deductive in
nature, so I think deductive compile time evaluation makes sense.
More information about the Digitalmars-d
mailing list