[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: 1: %

From: Gabriel Dos Reis
Subject: [Axiom-developer] Re: 1: %
Date: 03 Mar 2006 08:18:50 +0100

Ralf Hemmecke <address@hidden> writes:


| > | However, this behaviour is exactly, the difference between a constant
| > | and a nullary function in Aldor.
| > The difference is not that between a constant and a nullary function
| > -- btw, anything defined with "==" is a constant in Aldor :-)
| Yes. As I said. "y" is constant "y()" is not.

yes, however that is because the body is side-effecting, not just
because of "()".

| > if your nullary function y evaluates to the *same* value for same
| > argument each time, then  it would do just fine.
| I agree, but it does not evaluate to the same thing. And Aldor allows
| this.

yes, however the issue is with the implementation of y(), not because
of the the presence of ().  If "literal" was side-effecting you would
get similar trouble.

| I understand that mathematically a constant and a nullary
| function is not much of a difference. I would also conceptually agree
| if we speak about functional languages where there are no side
| effects. But Aldor allows side-effects.

I don't think the issue has to do with having a functional language or
For example, I have been working on a proposal

to require C++ compiler to evaluate calls to certain functions with
constant expressions at compile-time, provided their bodies are
"sufficiently simple".  Such functions achieve the mapping of
conceptual mathematical functions to computational ones.

|  > You won't see any difference.
| Except, maybe for the running time if the compiler is not smart enough
| to remove
| the function call and just replace it with the value.


| >  The real difference in your program is that of *binding time*.
| Of course, I agree, that "x" and "y()" can be treated as constants if
| "y" where a function in the mathematical sense (returning the same
| value for the same input). In that case it is just different "binding
| time".
| But in the example I gave in my previous mail. "y" is not a function
| that returns the same value in each invocation. And you don't think
| that is a difference?

There is a difference, but I do believe the fundamental reason if
becaue of "()".

-- Gaby

reply via email to

[Prev in Thread] Current Thread [Next in Thread]