Hi Phil,
Read-only tuples are mostly an optimization right now -- the new compiler is
able to perform stronger optimizations on read-only tuples.
However, even if you only write into a slot once, the usage of read-only
tuples is quite different from normal tuples -- many of the normal idioms
don't apply.
For example, a common way to write a constructor word is to use 'new' and
then call setters,
foo new
1 >>a
"hI" >>b
However this doesn't work with read-only tuples, you have to use 'boa'
instead.
So if you're constructing your tuple with a boa constructor and you never
set the slots after, there's no reason not to make it read only. Otherwise,
it might not be worth it unless you know the compiler will be able to
improve your code (I will document the new optimizations once they're
ready).
Slava
On Mon, Aug 11, 2008 at 8:00 AM, Phil Dawes <[EMAIL PROTECTED]> wrote:
> Hi Factor List,
>
> Single write tuple slots seem to be the norm in my code - is this
> generally the case?
>
> If so it might be worth considering making readonly slots the default in
> the new syntax.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk