Factor/To do/Static stack safety
- every word has a stack effect
- the effect is set at word construction time!
- stack effect can be unknown: ( ... )
- effect<= checks for an unknown
- if word calls words w/ unknown effect, don't compile
- call of unknown quot from optimized word checks effect
(( ... )) call-with
: foo ( ... q: ( a -- b ) -- ) call ;
- we don't want to load stack checker in stage1
- define calls a stack checker hook
- we no longer need usages xref, "inferred-effect" word-prop, "compiled-effect" word-prop
we can roll this out in phases:
phase 1: require declarations in all contexts and have :, HOOK:, GENERIC:
actually parse the declaration so omitting it is a syntax error
phase 2: introduce ... in stack effects and enforce it.
no such thing as an inference warning anymore!
phase 3: define-declared becomes define
phase 4: get rid of ... effects hopefully
issues:
- changing effect of inline ... word may bubble up to callers.
- we can get rid of ... words altogether if some combinators, such as
dip
, bi
, and so on, become strongly-typed.
done
- assert-depth should infer
This revision created on Fri, 5 Dec 2008 14:23:16 by slava