|Pliant talk forum
Discussion: cast of Argument
How to express cast for arguments?
|Message posted by maybe pom on 2002/05/02 12:46:47
|Assume I want to write a meta that copy an Array:X into an Array:Y, providing
that there should be some cast from X to Y.
It is easy in the meta to find what X and Y are. One may also create argument
to receive the cursors; But how do I do the cast ? Am I obliged to somehow
work at expression level, or is it possible to do it at instruction level ?
|Message posted by maybe Hubert Tonneau on 2002/05/02 12:51:37
|Array:X is also '(Array Y)' so you can define 'cast (Array Y)'
|Message posted by maybe pom on 2002/05/02 14:36:12
|I would have to define all the possible cast Array:Y for all the Y !
I would like to avoid this and somehow "inherit" the cast from X to Y.
|Message posted by maybe pom on 2002/05/02 15:24:34
|seeking "cast Y" would not be what I want (explicit cast may be used,
no general casting mechanism applied).
I think I have the answer:
var Link:Expression dummy :> expression ident "dummy"
dummy near e # dummy has to be linked to the module of e
dummy set_result myarg access_read
if not (dummy cast Othertype)
return # no cast is possible
e suckup dummy
# use of dummy:result as casted result