Damian Conway wrote:

Patrick R. Michaud wrote:

Ultimately I don't think I agree with the notion that sets and lists
are so different, or that sets deserve/require their own sigil.


Sets shouldn't have a sigil anyway, whether they're qualitatively different from lists or not. A set is a *value* (like an integer, or a string, or a list). A set is not a *container* (like an scalar or an array). And only containers get sigils in Perl.

Yet you're wanting to store something which holds different values (a junction) in a scalar field. I could see holding an enumerated set in an array, without any trouble at all. But junctions can be more than an enumeration of elements. To steal Patrick's example from before:


  $x = ($a & $b) ^ ($c & $d)

Which cannot be held in an array.

So my argument here is that none of the existing containers are suitable for holding a set/junction.

Scalars are meant to hold a single value. Junctions can hold several.
Arrays can hold many different values, but cannot store the interrelationship between then, as in the example above.
Hashes suffer the same problems as Arrays.


So my proposal was to create a new container, Sets, to store them in. I included the ability to store enumerated values, as well as create more complex logic via closures.

I was also attempting to add a bit of sanity to the semantics, by rephrasing things into something the average programmer would be able to parse. Given the numerous corrections to how one junction or another was parsed, I concluded that the exact semantics were becoming too subtle.


I also find the following incredibly disturbing:

>perl6 -e "$x = 'cat'|'dog'; say $x;"
dog
cat

Getting iterated executions of a statement without explicitly iterating it bothers me greatly. I work heavily in databases, where updating or inserting twice with one call can be fatal to data consistency.

So, if we are not having Sets, how exactly does one tell if what they are holding is a single value scalar, or a multi-value junction?

Can a junction hold values of completely different types, or just different values of the same type?

If evaluation of one value of a junction causes an error, is $! now a junction as well?


-- Rod Adams



Reply via email to