One more idea: could you implement the sort of thing being asked for
by means of a buffer? That is, what's the difference between the
bitset being asked for and a Buf[boolean]? And could those
differences be addressed by composing a Buf[boolean] into a more
appropriate role?
Note also that Perl
On Wed, 7 Apr 2010, yary wrote:
> 2010/4/6 Larry Wall :
> > Set(Read | Write) # bogus, R|W is really 3 sets, R, W, and RW!
> > Set(Read & Write) # okay, can only represent RW
>
> Set(A | B) doesn't seem so bogus to me, if what you want is the power
> set
Hmm, surely a power-set would be
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Apr 7, 2010, at 00:52 , Larry Wall wrote:
more syntactic and/or semantic sugar. It's just a bit awkward, after
you say:
enum Permissions ;
subset Perms of Set of Permissions;
that the name of the single-member sets are
Perms(Read)
Pe
2010/4/6 Larry Wall :
> Set(Read | Write) # bogus, R|W is really 3 sets, R, W, and RW!
> Set(Read & Write) # okay, can only represent RW
Set(A | B) doesn't seem so bogus to me, if what you want is the power
set- not the original posters intent, but reasonable in other
contexts. Though it
> We could make enum declarators even more like constant declarators
> by using a pseudo assignment. Then we could use = instead of parens:
>
> enum Perms = Z=> 1,2,4...*;
Hmm. That doesn't seem very like constant declarators. In a
constant declarator,
the constant appears on the lhs and
Jonathan Lang wrote:
> Wouldn't that be C< = 0...* >?
Indeed. Thanks for the correction.
> That said, don't we already have a means of assigning specific values
> to individual members of an enum? I forget the exact syntax,
The exact syntax is:
enum Perms [Read => 1, Write => 2, Exec =>
On Wed, Apr 07, 2010 at 06:33:46AM -0700, Jon Lang wrote:
: That said, don't we already have a means of assigning specific values
: to individual members of an enum? I forget the exact syntax, but I
: believe that it involves an assignment operator within the
: enumeration. Mind you, this is from
Damian Conway wrote:
> I do like the idea of being able to specify the sequence of values of an
> enumeration by using a series of some kind.
>
> And I must say the one that feels most natural is the one that plays on
> the equivalence of underlying equivalence of enums and constants, namely:
>
>
Daniel Ruoso pointed out:
> Using bitsets in Perl 6 is just as easy as using in Perl 5 -- which
> happens to be the same as using in C, but it's not C...
>
> constant PERM_WRITE = 0b0001;
> constant PERM_READ = 0b0010;
> constant PERM_EXEC = 0b0100;
> constant PERM_NAMES = { PERM_WRITE => 'Write
Larry mused:
> Alternatively, maybe there should be some way to express infinite sets.
> Not sure I like the idea of an infinite junction, but something resembling:
>
> subset PowersOf2 of Int where any(1,2,4...*)
> enum Perms of PowersOf2 ;
> say Exec; # 4
>
> Presumably the series in t
Em Ter, 2010-04-06 às 22:19 -0700, Damian Conway escreveu:
> > I kinda hope we can get a bit further away from the machine code
> > level of reality one of these decades. Perl 6 should not be
> > optimized for C semantics.
> Agreed. But it should at least support those who need to work at
> the ma
On Tue, Apr 06, 2010 at 10:19:15PM -0700, Damian Conway wrote:
: Larry concluded:
:
: > I do freely admit that most Perlfolk are not used to thinking of
: > permissions in terms of set theory. But as I said, we're looking at
: > kind of a strange use case here, and perhaps not typical of the kind
Larry concluded:
> I do freely admit that most Perlfolk are not used to thinking of
> permissions in terms of set theory. But as I said, we're looking at
> kind of a strange use case here, and perhaps not typical of the kinds
> of sets of small numbers that people will be using in the future.
Th
On Tue, Apr 06, 2010 at 08:47:11PM -0700, Geoffrey Broadwell wrote:
: First: what Damian said.
:
: Second: Whatever syntax people come up with has to make it easy and
: type-safe to name particular combinations of those bits.
:
: In other words, you should be able to make a bitset with Unix-style
On Tue, Apr 06, 2010 at 08:31:24PM -0700, Damian Conway wrote:
: An issue came up in a class I was teaching today...
:
: There doesn't seem to be an easy way to create a type that allows a set
: of enumerated bit-flags *and* all the combinations of those flags...and
: nothing else.
:
: For exampl
First: what Damian said.
Second: Whatever syntax people come up with has to make it easy and
type-safe to name particular combinations of those bits.
In other words, you should be able to make a bitset with Unix-style
permissions:
OTHER_EXECUTE
OTHER_WRITE
OTHER_READ
GROUP_EXECUT
An issue came up in a class I was teaching today...
There doesn't seem to be an easy way to create a type that allows a set
of enumerated bit-flags *and* all the combinations of those flags...and
nothing else.
For example:
enum Permissions ( Read => 0b0001, Write => 0b0010, Exec => 0b0100 )
17 matches
Mail list logo