Non-type parameters to domains

0 views
Skip to first unread message

Waldek Hebisch

unread,
Mar 17, 2021, 10:20:10 PM3/17/21
to fricas...@googlegroups.com
There were/are various problems with using non-trivial non-type
parameters to constructors. The change that I recently
commited fixes one rather fundamental problem. Namely,
before helper Boot function 'devaluate' were called on
all constructor parameters. 'devaluate' could mangle
non-domain values or could crash on them. 'devaluate'
had a few tests so that it worked fine in most common
cases, but more interesting ones (basically vectors
or records) could cause trouble. Now, 'devaluate' is
only called on parameters which are types. So all
values should work as parameters for constructors.

Note: this fixes only one problem. There are others:
- 'devaluate' is still called in conditions
- compiler (at least potentialy) may miscompile literal
constant parameter
- compiler typechecking may get confused by literal
constants
- interpreter may use different representation of constants
than compiler
- printing types may crash on embedded constants

In other words, I fixed just one very fundamental bug, and
other problems may prevent use of types with non-type
parameters. However, as long as use is strictly at
Spad level, types are not used in conditions and
parameters are first assigned to variables and
only variables are passed to constructors, then arbitrary
non-type parameters probably should work (I know of no obstacle
to such use).

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages