[M3devel] NARROW(refanyValue, procedureType)

Rodney M. Bates rodney_bates at lcwb.coop
Sun Apr 7 18:21:40 CEST 2013



On 04/06/2013 01:40 PM, Dragiša Durić wrote:
> Is this possible in any way? Can I use any Sequence/Table type to hold procedure typed values inside?
>
> new source -> compiling XLModule.m3
> "../src/XLModule.m3", line 181: NARROW: types must be assignable
> "../src/XLModule.m3", line 239: incompatible types (x)
>

 From 2.2.10:

NULL <: REF T <: REFANY
and similarly, any object type <: ROOT <: REFANY

but while NULL <: PROCEDURE...
NOT PROCEDURE... <: REFANY  nor PROCEDURE... <: ADDRESS

Which is why you can't assign a procedure value to a pointer of any kind, nor
can you narrow a pointer back to a procedure.  Changing the language to allow
this would, I think, entail significant implementation complexity.

Do you want all of the procedure values in the sequence to be the same
procedure type?  If so, you should be able to just instantiate Sequence
using an interface containing a T that is this procedure type.  No
runtime NARROW overhead, and more static checking.

Otherwise, Mika's wrapping example should be extensible by having a different
wrapper type around each needed procedure type.  Then they could be mixed and
matched in a single sequence.

> Second one is RefSeq.T.addhi(procedureType)
>
> TIA,
> dd
> --
> Dragiša Durić
> dragisha at m3w.org <mailto:dragisha at m3w.org>
>
>
>




More information about the M3devel mailing list