[Aldor-l] Bool$Machine vs Bool$Builtin
tmgisi at gmx.at
tmgisi at gmx.at
Wed Nov 21 16:20:44 EST 2007
Hi Ralf,
On Sat, 17 Nov 2007 17:26:38 +0100, Ralf Hemmecke <ralf at hemmecke.de> wrote:
> Can somebody explain the differences of what happens
> for "aldor $opts aaa.as"
> when opts is "BUILTIN", "MACHINE", and ""?
"MACHINE" and "" compile and run.
"BUILTIN" compiles and segfaults.
> #if BUILTIN
> import {Bool: Type; BoolNot: Bool->Bool} from Builtin;
How do you know Builtin exports "Bool: Type"?
I supposed Builtin only exported functions...
Well ;) you seem to have sold your soul and looked at the compiler sources and thereby you know.
In any case, as no authoritive person from aldor.org discusses the question with us, I'll get the discussion started by sharing my view of the subject. I guess the discussion is really about the intertwining of Aldor's layers and not too much about boolean values. So I'll first share my point of view on these layers.
When designing a compiler and language, you need some "interface" between the stuff provided by the compiler and the code the user writes.
Typically the compiler will provide numbers, strings etc.
And code from users want to use these numbers, strings.
>From my point of view, the Aldor compiler provides functions (Before studying your code, I was cocksure that the compiler exports only functions. The reason being the design and usage of "pretend" and the basis library. However, the compiler at least accepts your import of "Bool: Type"... Who knows...) as its "interface" to the user code.
Every user can get a hold of these functions and play around with them.
However, from a maintainers point of view, this may become a hassle and it might proof valuable to introduce a maintenance layer around the exported functions.
This new layer should be used by user code. This layer is considered stable.
The direct "interface" to the compiler still exists but is no longer considered "that stable".
In case the compiler (for whatever reasons) changes its interface to the user code, this layer may make up for it, and still provide the some exports to the user.
For Aldor, the Machine domain looks just like such a layer.
Further domains (MachineInteger, ...) are then designed on top of this layer.
So to me, Builtin goes rather straight to some layer underneath the Aldor language (be it FOAM, compiled C code, ...)
The Machine domain is wrapping it up nicely.
Now back to Boolean and Bool.
Bool presents an Aldor domain for the functions for boolean values provided by the compiler. Bool is just syntactic sugar.
Boolean is just using the Bool domain. It does not need to.
If Boolean does not use Bool, it should be quite careful to handle the correct values for true and false down to the compiler.
In any case do not get mislead by thinking that the compiler uses the domain Boolean to check your conditions ;)
Kind regards,
Christian
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
More information about the Aldor-l
mailing list