Oh.  I had missed the bit about set-model.  I read the references, but
I'm still confused.  I added the stack effect (simplified the example)
to this:

IN: foo

USING: accessors models ;

TUPLE: m < model ;

: <m> ( value -- model ) m new-model ;

M: m (>>loc) ( value object -- ) set-model ;

With the stack effect factor still blows up.  Since the inferred
effect is stronger, then declaring an effect won't fix the problem,
hence the continued problems.

Sorry, but I still don't get it.
Steve




On Wed, Feb 4, 2009 at 5:40 AM, Slava Pestov <[email protected]> wrote:
> On Wed, Feb 4, 2009 at 4:30 AM, Steve Weeks <[email protected]> wrote:
>> I tried specifying the stack effect in the method body and still get
>> problems.
>
> Whether or not a word has an inferred effect is a stronger property
> than an effect being declared. You are right that one does not have to
> declare effects on methods, but here the problem is that the compiler
> is unable to prove that the 'set-model' word (and hence any caller of
> it) has a static stack effect.
>
>>  I think the issue is that there is no slot "loc" when I
>> code
>>
>>  M: loc-model (>>loc) set-model ;
>>
>> The line:
>>
>> M: loc-model  loc>> value>> ;
>>
>> doesn't cause any problems, which seems strange since it to is using a
>> generic without the slot being defined in the tuple.
>
> No, that's not the problem. There are a few places in the code where I
> define 'virtual slots' in this manner. Try this for instance,
>
> TUPLE: my-tuple i ;
>
> SLOT: s
>
> M: my-tuple s>> i>> number>string ;
> M: my-tuple (>>s) [ string>number ] dip (>>i) ;
>
> The SLOT: parsing word merely ensures that the generic words s>> and
> (>>s) exist, if they don't already.
>
> The issue with your specific example is that the method bodies should
> have static stack effects, and as I've mentioned before set-model does
> not. You can read more about this in the FAQ. See the question, "What
> are compiler errors and warnings", in
>
> https://concatenative.org/wiki/view/Factor/FAQ/Develop
>
> and check out the documentation pages referenced therein.
>
> Slava
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to