You probably mean:
x := foo()$Foo(10000)
y := foo()$Foo(10000)
^^^^^
or some other fixed number.
Ah, yes, of course.
Yes. Of course, I would like to forbid 'random' but I am
affraid it is not possible in general without also forbiding
functions which non-type arguments to types useful.
Well, yes. I think I would already be satisfied with the specification
that whenever someone uses a function in a type (similar like random in
my example), the programmer must ensure (or in other words the compiler
assumes) that this function is a pure function without side effects.
This assumption must be written somewhere in big letters.
In case of DMP number of variables
much match size of the product.
As written before, I would put the variables into the "exponent" parameter.
For DirectProduct
one of natural operation is concatention, but
this takes arguments of size n and m and produces
result of size n + m.
You would have an operation
DPC==>DirectProductCategory
concat: (DPC(m, R), DPC(n, R)) -> DPC(m+n, R)
(assuming the R is known from somewhere.
But look more closely at the definition of DirectProductCategory. The
dim parameter is not at all used in the "with" part. It's completely
useless to carry it around in the category argument.
So we would have
concat: DPC(R), DPC(R)) -> DPC(R)
and the resulting domain exports a function
dimension:()-> NonNegativeInteger
from which one could extract the size of the product.
... you are forced to use arbitrary size domain and
check sizes at runtime.
Of course I understand the usefulness of types like arrays of a fixed
size or vectors of a fixed dimension (different from Vector -- which is
the union over all finite dimensional vector spaces).
Of course, if type
parameters are given by functions you can finish
typechecking only at runtime. But IMHO it still
has advanteges:
- some common cases can be checked at compile time
(by comparing parse trees of expressions)
- even if you need runtime checking (not implemented
in current compiler) checking in types should be
more efficient than checking in each operation and
checks in types can be automatically generated by
compiler, while for arbitrary sized domains programmer
need to insert checks by hand (and may forget some...).
Oh, I am not at all against a mild compile time evaluation that enables
Foo(2+3) to be identified with Foo(4+1) or Foo(5). But I guess that
needs some thoughts to get it properly specified, how much computation
can be allowed at compile time.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.