[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamica
From: |
William Sit |
Subject: |
Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamically typed(was:Philosophy... ) |
Date: |
Mon, 26 Sep 2005 10:54:46 -0400 |
Ralf Hemmecke wrote:
> [from www.aldor.org:]
> >>>>Types and functions are first class entities allowing them to be
> >>>>constructed and manipulated within Aldor programs just like any
> >>>>other value.
>
> Interesting. If that were so easy, it would be possible to ask a type
> for the functions it implements.
Exactly. It has been a long standing (but lost) request (I believe from me) that
Axiom constructors (that include category, domain and packages, but not the
developers :-)) allow query of their arguments. It is useful, for example, to be
able to distinguish whether a field is a quotient field of some integral domain
or just a field to make codes more efficient. The request was not acted upon
because at the time (around 1990 +/- 3 years?), effort was concentrated on
developing the Aldor (A#) compiler, which promised to solve such problems.
> Aldor allows something like
>
> #include "aldor"
> #include "aldorio"
> Dom: with {
> foo: % -> Boolean;
> } == add {
> foo(x: %): Boolean == true;
> }
>
> import from Dom;
> if Dom has with {foo: % -> Boolean} then {
> stdout << "foo is there" << newline;
> } else {
> stdout << "foo is missing" << newline;
> }
>
> However, I cannot, for example, write a function that returns a list of
> names of functions implemented in Dom. (That is the current knowledge I
> have.)
In other words, if I understand the example, you can't list unless you already
know?
Listing functions in a domain is not a simple question in Axiom. Functions can
be inherited from parent constructors or exported as new. It also depends on in
what form you want the list. Surely, by doing a ")show Dom" (this is in the
interpreter: I am not aware of any compiler equivalent) you get that list. So
are you simply asking to be able to assign the output of ")show Dom" to a string
variable? Tim may be able to provide such a general assignment construct?
> And, of course, I see no way of morphing the result of "foo" to
> "false" without writing a new function.
That is what I was asking: code modification. Like you, I also interpret "first
class object as data" that way (but that need not be the "official"
interpretation).
> I am not aware of
> a language construct that invokes the compiler during the runtime of a
> program. (The compiler might not even present on the target machine.)
>
Thanks for this info. The interpreter of Axiom can invoke the compiler of
course. But the above meant calling the compiler from within a compiled function
at run time. Any comments from others?
William
- [Axiom-developer] RE: Static versus Dynamically typed (was: Philosophy... ), Bill Page, 2005/09/23
- Re: [Axiom-developer] RE: Static versus Dynamically typed (was:Philosophy... ), William Sit, 2005/09/23
- RE: [Axiom-developer] RE: Static versus Dynamically typed (was:Philosophy... ), Bill Page, 2005/09/23
- Re: [Axiom-developer] RE: Types as values, and Re: Static versus Dynamically typed(was:Philosophy... ), William Sit, 2005/09/24
- Re: [Axiom-developer] RE: Types as values, and Re: Static versus Dynamically typed(was:Philosophy... ), Ralf Hemmecke, 2005/09/26
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamically typed(was:Philosophy... ),
William Sit <=
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamically typed(was:Philosophy... ), Ralf Hemmecke, 2005/09/26
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), William Sit, 2005/09/26
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Ralf Hemmecke, 2005/09/27
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Martin Rubey, 2005/09/27
- RE: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Vanuxem Gregory, 2005/09/27
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Ralf Hemmecke, 2005/09/27
- RE: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Vanuxem Grégory, 2005/09/27
- Re: [Axiom-developer] RE: Types as values,and Re: Static versusDynamicallytyped(was:Philosophy... ), William Sit, 2005/09/28
- Re: [Axiom-developer] RE: Types as values,and Re: Static versusDynamicallytyped(was:Philosophy... ), Martin Rubey, 2005/09/28
- Re: [Axiom-developer] RE: Types as values, and Re: Static versusDynamicallytyped(was:Philosophy... ), Ralf Hemmecke, 2005/09/28