It will always *print* as f, as far as I know, but it serves a purpose
if you're writing code: specifically, it allows you to do a literally
initialized tuple based on slot names and values, rather than always
using boa form. E.g., given
TUPLE: triplet a b c ;
then these are all equivalent:
T{ triplet f 1 2 3 }
T{ triplet { a 1 } { c 3 } { b 2 } }
1 2 3 triplet boa
That said, I don't use this outside the REPL, and haven't even used it
there in forever, partially because you need an immediate clone in most
use-cases (just like you do with e.g. V{ } or H{ }), and partially just
because the alternative style of
triplet new
1 >>a
2 >>b
3 >>c
is simply more common in the stdlib. I'm not aware of any performance or
safety penalties for going the literal route, however. In particular,
things like tuple specialization markers (e.g. TUPLE: onlystring { s
string } ; will properly reject T{ onlystring { s 1 } }). So maybe this
is just inertia from all of us at this point.
Cheers,
--Benjamin
On Fri, Apr 14, 2017, at 05:14 AM, Alexander Ilin wrote:
> Hello!
>
> In the literal tuple syntax there is that first `f` that I'd like to
> ask about:
>
> T{ class-name ***f*** slots... }
>
> What does it mean? Does always have to be `f`? Can it be something
> else?
>
> ---=====---
> Александр
>
> ----------------------------------------------------------------------
> --------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _________________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk