|
From: Alexandre F. <ale...@gm...> - 2008-06-15 20:49:47
|
On 6/15/08, Fredderic Unpenstein <mag...@gm...> wrote:
>
> How do the [cons] or [list] based methods achieve this? By using some
> value that they hope no one else will use. But what to do if some
> piece of script comes along and wants to return a string that just
> happens to look like the string rep of your [cons] and [list] methods.
No, you missed the point.
The Maybe method (be it implemented with Neil's package, with Cons, or
wit hplain 2-element lists) encodes the nullity of a value
out-of-band:
(example with 2-element lists as it is doable in pure Tcl)
Nothing == {0 whatever}
Some foobar == {1 foobar}
for any $x
Some $x ==[list 1 $x]
You can see that no $x this side of the universe will swallow the "1 "
prefix (since you're talking about string reps).
-Alex
|