[Aldor-l] Compiling setup

Gabriel Dos Reis gdr at integrable-solutions.net
Fri Aug 11 06:52:33 EDT 2006


"Christian Aistleitner" <tmgisi at gmx.at> writes:

[...]

| However, you might also consider my test.as to be of extremely
| miserable  style.
| After all, I am assigning a constant ("abcdefghij") to a variable (a).
| Afterwards I use a destructive function( set! via a.3) on the variable
| (actually, the constant "abcdefghij"). Replacing
|    local a: String := "abcdefghij";
| by
|    local a: String := copy "abcdefghij";
| gives code that's working even without -fwritable-strings.

But, in the face of it, the issue is not that of "bad style" versus
"good style".  It is a pure bug in the translation the compiler does.


You are however correct that, given that the erroneous translation
(from the only compiler available) is known  and documented, it is not
just bad style but actually a programming error.


"a" above is not a constant -- or else the language could have
forbidden its modification.  The declaration above *initializes* the
variable with a certain (immutable) value.  Consequently, it is a
plain erroneous translation that the compiler compiles the code to
modify the immutable value. 

Given that the language allows modification of a, consider that the
declaration  

     local a: String := "abcdefghij";

should have been translated to the equivalent of 

     char a[] = "abcdefghij";

and *NOT*

     char *a = "abcdefghij";

If you initialize an integer variable with the integer literal 1, and
you subsequently modify that variable to hold 2, do you expect the aldor
compiler to pretend that the *integer literal 1* is actually 2?

[...]

| The question is about "What is considered bad style?".
| aldor.conf explicitly deals with the issue of whether string literals
| are  read-only or not, so I doubt that Aldor compiler developers
| consider it  bad style.

aldor.conf is a workaround about an erroneous translation.  It has
proven to be quite fragile and non-scalable.

I'm quite amazed that such a plain error in the translation is
being hidden by "bad or good style of programming" rhetorics.

-- Gaby



More information about the Aldor-l mailing list