[M3devel] NARROW(refanyValue, procedureType)

mika at async.caltech.edu mika at async.caltech.edu
Sun Apr 7 19:23:59 CEST 2013


I should add that m3tk could be used to generate such procedure type
wrappers automatically.

It's one of the things I never got around to in my Scheme system (since
you can usually just use OBJECTs anyhow, at least if you control the
source code), but it shouldn't be too difficult...

     Mika

"Rodney M. Bates" writes:
>
>
>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