Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
On Thu, Jan 09, 2003 at 07:55:20PM -0500, John Siracusa wrote:
> Has there been any discussion of how to create code in Perl 6 that's there
> under some conditions, but not there under others?  I'm thinking of the
> spiritual equivalent of #ifdef, only Perlish.
> 
> In Perl 5, there were many attempts to use such a feature for debugging and
> assertions.  What everyone wanted to do was write code like this:
> 
> debug("Doing foo with $bar and $baz");
> foo($bar, $baz);

I would assume it to be a compiler hint via subroutine attribute.

sub debug ($msg) is off {
print STDERR $msg;
}

some "this subroutine is a no-op if a flag is set" attribute.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl Quality Assurance  <[EMAIL PROTECTED]> Kwalitee Is Job One



Re: "Disappearing" code

2003-01-10 Thread Michael G Schwern
On Thu, Jan 09, 2003 at 11:15:49PM -0500, John Siracusa wrote:
> On 1/9/03 10:10 PM, Michael G Schwern wrote:
> > I would assume it to be a compiler hint via subroutine attribute.
> > 
> >   sub debug ($msg) is off {
> > print STDERR $msg;
> >   }
> > 
> > some "this subroutine is a no-op if a flag is set" attribute.
> 
> Hm, not quite as convenient as setting a package global (constant)
> somewhere.  Maybe that same "off" bit could be set "from a distance" at
> compile time?

That would be the "if a flag is set" part.  Point is, its easily handled
by some sort of subroutine attribute which looks at some flag somewhere.

'off' was a bad name for it.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl Quality Assurance  <[EMAIL PROTECTED]> Kwalitee Is Job One



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread attriel
> print sort { ... } <~ mymethod(42) <~ @b;
>
> call sort on what comezouta calling mymethod(42) on what comezouta @b.
> I think. Indirect objects are still somewhat confusing. :)
>
> If I'm reading the info right on <~, then we want to make it clear
> that you  _don't_ put it between print and stuff you want to print, or
> in other words  that "this ain't cout".

If I read the conversations right, I think that line is trying to do:

print (to stream mymethod(@b,42)) sort { ... }

I think to make it work like you wanted, you need ()'s

print (sort { ... } <~ mymethod(42) <~ @b); so that the <~ is directly
associated with the sort; otherwise sort is a param to the print, and
we're comezouta'ing the "where do i print sort"

and sort takes the "how do i sort" first and the "What do i sort"
second, yes?  which makes me now wonder about all the sort { ... } <~
examples, and my understanding of the whole "where do <~ and ~> stick
things?" thing ...

OK, looking back, <~ binds to the "indirect object" ... and Damian's
examples use map { ... } and grep { ... } with <~'s, so I guess the
indirect object would work the same for sort { ... }, but now I'm not real
sure on what the indirect object IS in all these calls ...

Could someone explain how to know what's the indirect object?  (who knew
the "sentence diagramming" would be USEFUL!!)

--attriel






Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/9/03 11:27 PM, Michael G Schwern wrote:
> On Thu, Jan 09, 2003 at 11:15:49PM -0500, John Siracusa wrote:
>> On 1/9/03 10:10 PM, Michael G Schwern wrote:
>>> I would assume it to be a compiler hint via subroutine attribute.
>>> 
>>>   sub debug ($msg) is off {
>>> print STDERR $msg;
>>>   }
>>> 
>>> some "this subroutine is a no-op if a flag is set" attribute.
>> 
>> Hm, not quite as convenient as setting a package global (constant)
>> somewhere.  Maybe that same "off" bit could be set "from a distance" at
>> compile time?
> 
> That would be the "if a flag is set" part.  Point is, its easily handled
> by some sort of subroutine attribute which looks at some flag somewhere.

Well, er, don't we need to decide what the subroutine attribute is, so that
the compiler will know to honor it and make the code "disappear"?  It
doesn't seem like a feature that can be added from "userland" after the fact
(but maybe I'm wrong...)

-John




Re: "Disappearing" code

2003-01-10 Thread Rafael Garcia-Suarez
John Siracusa <[EMAIL PROTECTED]> wrote:
> 
> Well, er, don't we need to decide what the subroutine attribute is, so that
> the compiler will know to honor it and make the code "disappear"?  It
> doesn't seem like a feature that can be added from "userland" after the fact
> (but maybe I'm wrong...)

In Perl 5 that could be done from userland, as you say, by using an
optree manipulator (optimizer.pm for example). This could even be
lexically scoped. [Once the compiler hints are fixed.]

I expect Perl 6 to ship with (Parrot::* ?) modules that allow to examine and
to modify the compiled form of the programs. Something that probably Java 6
will not have...



Re: Variable Types Vs Value Types

2003-01-10 Thread Damian Conway
attriel wrote:


AssignmentOK?Because...
========
my Basket $c = $a no $c's type:  Basket (of Object)
   X  ^
   |  |
 $a's type:   Set  of   Apple
my Basket of Apple $c = $aok $c's type:  Basket of Apple
   ^ ^
   | |
 $a's type:  Basket of Apple


Now, just to be sure I didn't miss a step:

That second entry is wrong, sin't it?  it should be OK? no b/c:

C's Type : Basket of Apple
  X^
  ||
A's Type :   Set  of Apple

yes?


Quite correct. I messed up A's type. :-(
Could the Secret Maintainers of Perl 6 Truth please update that for the records.

Thanks,

Damian





Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Damian Conway
Andy Wardley wrote:


s/~=/=~/


Indeed. And that's precisely why we're changing it to ~~ in Perl 6. ;-)



The first 3 all relate to the familiar concept of 'minus', or more 
precisely a delta between two values.  The last uses '-' as 'dash',
another familiar concept which doesn't grate against the first usage,
IMHO.

Just as ~> and <~ use ~ as a "squiggly dash", which doesn't grate either,
IMHO.



The arrow is a special case.  I don't read that first character
as '-', I think of the operator as one.  I guess the visual cue forces
me to see it like that.


I'm suggesting that ~> and <~ will be the same.



I'm just suggesting the same for the ~ character:


This is where I get lost.  I see 4 different concepts being overloaded
onto '~'.


I'd suggest that that's simply because your brain hasn't yet "chunked" the
various uses of the ~ character in these four multicharacter symbols,
the way it already has with the - character. So you read the ~'s as symbols
rather than characters within symbols, which leads to the "matchy" or
"stringy" overtones of their appearance to you.

But once that chunking does occur for you -- and I'm suggesting it would --
then ~> and <~ will become atomic symbols in your brain, and I think the
issue will disappear.

Nevertheless, I deeply respect your concerns and your opinions, and appreciate
that you look the time to set them out so clearly.

So, we're going to have to agree to differ, I suspect. Having presented our
respective arguments cogently in this forum, we can happily sit back and
let Larry shoulder the burden of deciding this.

Thanks, Andy.

Damian




Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Damian Conway
Mr. Nobody wrote:


I find the normal function call and assignment far more readable than using
some weird ugly operator.


and later:


That's going to be just plain confusing. Arguments to functions are supposed
to be on the right. And what's up with using them for assignment? That's
making them even more overcomplicated and ugly. Do you care about readability
at all?


You know, I usually find this kind of unsupported, emotive, ad hominen attack
utterly unconvincing.

But in this case, I find that your novel approach to our collaborative discussion
*has* convinced me of something.

*PLONK*

Damian




Re: Variable Types Vs Value Types

2003-01-10 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes:

> attriel wrote:
>
>> AssignmentOK?Because...
>> ========
>> my Basket $c = $a no $c's type:  Basket (of Object)
>>X  ^
>>|  |
>>  $a's type:   Set  of   Apple
>> my Basket of Apple $c = $aok $c's type:  Basket of Apple
>>^ ^
>>| |
>>  $a's type:  Basket of Apple
>> Now, just to be sure I didn't miss a step:
>> That second entry is wrong, sin't it?  it should be OK? no b/c:
>> C's Type : Basket of Apple
>>   X^
>>   ||
>> A's Type :   Set  of Apple
>> yes?
>
> Quite correct. I messed up A's type. :-(

> Could the Secret Maintainers of Perl 6 Truth please update that for
> the records.

If you want me to doctor the summary you're going to have to do better
than a simple 'please' mate. I want personal tuition on making
presentation software actually *enhance* the presentation...



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Austin Hastings

--- attriel <[EMAIL PROTECTED]> wrote:
> Could someone explain how to know what's the indirect object?  (who
> knew
> the "sentence diagramming" would be USEFUL!!)

Short version:

If there's two people in the sentence, the verb-ee is either the direct
or indirect object. If there's two people and a thing, the -ee is
indirect.

I hit him. (He's the direct object.)

I gave the ball to him. (Ind.)

In reality, the reference to "indirect object" is a bogus equivalence,
because we're really making the SUBJECT of the sentence, as

hit him :I

becomes

I.hit(him)

However, the original term was a reference to "Using an OBJECT's method
INDIRECTly", hence indirect object notation.

Just to make things less simple.

=Austin




Re: "Disappearing" code

2003-01-10 Thread Dan Brook
On Thu, 09 Jan 2003 19:55:20 -0500
John Siracusa <[EMAIL PROTECTED]> wrote:

> Has there been any discussion of how to create code in Perl 6 that's
> there under some conditions, but not there under others?  I'm thinking
> of the spiritual equivalent of #ifdef, only Perlish.

If the perl6 command-line options are anything like perl5 then you
can just use the -P switch if preprocessor commands are your thing.

> In Perl 5, there were many attempts to use such a feature for
> debugging and assertions.

There has also been a proposal for patching perl5 to add assertions
which was recently discussed[1] on p5p, which if accepted has
implications for assertions in perl6 surely.

Dan

[1]
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-11/msg00325.html



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Paul Johnson

Damian Conway said:

> Andy Wardley wrote:
>> The arrow is a special case.  I don't read that first character
>> as '-', I think of the operator as one.  I guess the visual cue forces
>> me to see it like that.
>
> I'm suggesting that ~> and <~ will be the same.

I think that in part this may depend on the font being used.

When I first saw these symbols, via webmail on a browser, the tilde
appeared half way down the character, in the same position as the dash. 
This made it obvious to me that it was an arrow of some sort, and it
looked good.

When I later saw it using mutt in an xterm, the tilde was at the top of
the character, where I was more used to seeing it and it didn't look like
an arrow any more, nor did it look very good to me.

This is the way it looks on my browser  ~>

When I get home I'll mail a message showing how it looks in my xterm ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/10/03 11:11 AM, Dan Brook wrote:
> On Thu, 09 Jan 2003 19:55:20 -0500
> John Siracusa <[EMAIL PROTECTED]> wrote:
>> Has there been any discussion of how to create code in Perl 6 that's
>> there under some conditions, but not there under others?  I'm thinking
>> of the spiritual equivalent of #ifdef, only Perlish.
> 
> If the perl6 command-line options are anything like perl5 then you
> can just use the -P switch if preprocessor commands are your thing.

Source filtering is not exactly the solution I'm looking for... :)

-John




Re: "Disappearing" code

2003-01-10 Thread Damian Conway
John Siracusa asked:


Has there been any discussion of how to create code in Perl 6 that's there
under some conditions, but not there under others?  I'm thinking of the
spiritual equivalent of #ifdef, only Perlish.

In Perl 5, there were many attempts to use such a feature for debugging and
assertions.  What everyone wanted to do was write code like this:

debug("Doing foo with $bar and $baz");
foo($bar, $baz);

And then have the entire call to debug() just plain disappear when the
program was run with a certain flag, or when a particular constant was set,
or whatever.  The closest we got in Perl 5, AFAIK, was stuff this:

use constant DEBUG => 0;
...
debug("Doing foo with $bar and $baz") if DEBUG;
foo($bar, $baz);

But all those "if DEBUG"s or "DEBUG &&"s were a pain.  So I'm wondering what
the solution will be in Perl 6.


Something like this:

	module Debug;

	my $debugging = 1;

	method import ($debug) { $debguuging = $debug }
	
	sub debug is immediate is exported (@message) {
	return $debugging ?? { print $*STDERR: @message; } :: {;}
	}

then:

	use Debug;

	debug("Doing foo with $bar and $baz");

and to deactivate the debug statements:

	use Debug 0;

	debug("Doing foo with $bar and $baz");
	

"Immediate" subroutines are executed as soon as they are parsed (i.e. they're
like named BEGIN blocks).

Returning a closure/block from an immediate sub called in a void context
(as C is in the example above) causes the immediate sub call to be
replaced -- during compilation! --  by the returned closure/block.

Voila! Perl 6 is its own macro language.

Damian




Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Damian Conway
Trey Harris raised the spectre of:


shades of C++, how about just

  $*STDERR <~ $foo;


Yes. Assuming C were suitably overloaded.


or

  $foo ~> $*STDERR;


Yes. Assuming C were suitably overloaded.

Not sure whether that would come "standard", but if not, here's
a first cut of the necessary module for future reference:

	module IO::Stroustrupian;

	# Output operators...
	my infix::<~(IO $fh, $datum) is multi is exported { print $fh: $datum }
	my infix::<~(IO $fh, @data)  is multi is exported { print $fh: @data  }
	my infix::~>($datum, IO $fh) is multi is exported { print $fh: $datum }
	my infix::~>(@data,  IO $fh) is multi is exported { print $fh: @data  }
	
	# Input operators...
	my infix::<~($var is rw, IO $fh) is multi is exported { $var = <$fh> }
	my infix::<~(@var is rw, IO $fh) is multi is exported { @var = <$fh> }
	my infix::~>(IO $fh, $var is rw) is multi is exported { $var = <$fh> }
	my infix::~>(IO $fh, @var is rw) is multi is exported { @var = <$fh> }


Damian





~> and <~ become |> and <| (was L2R/R2L syntax )

2003-01-10 Thread Jim Cromie
Damian Conway wrote:


Can I suggest that an alternative solution might be the following:

So an L2R array-processing chain is:

@out = @a ~> grep {...} ~> map {...} ~> sort;

There might also be a be special rule that, if the RHS is
a variable, the LHS is simply assigned to it. Allowing:

@a ~> grep {...} ~> map {...} ~> sort ~> @a;

Further suppose that <~ takes its right argument, and binds
it in the indirect object slot of the left argument, which
argument it then calls. So an R2L array-processing chain is:

@out = sort <~ map {...} <~ grep {...} <~ @a;

Or, under a special rule for variables on the LHS:

@out <~ sort <~ map {...} <~ grep {...} <~ @a;

That way, everything is still a method call, the ultra-low precedence of
<~ and ~> eliminate the need for parens, and (best of all) the 
expressions
actually *look* like processing sequences.

Damian



my knee-jerk reaction,

|> is evocative of pipelines in bash, etc...
<|  is somewhat less evocative, but related to <(cat *)  as a 
sub-process  (in csh ??)

yours feels slightly less noisy, but also less familiar/mnemonic.




Re: "Disappearing" code

2003-01-10 Thread John Siracusa
On 1/10/03 12:24 PM, Damian Conway wrote:
> "Immediate" subroutines are executed as soon as they are parsed (i.e. they're
> like named BEGIN blocks).
> 
> Returning a closure/block from an immediate sub called in a void context
> (as C is in the example above) causes the immediate sub call to be
> replaced -- during compilation! --  by the returned closure/block.
> 
> Voila! Perl 6 is its own macro language.

Sweet :)

-John




Re: Array Questions

2003-01-10 Thread Michael Lazzaro
On Thursday, January 9, 2003, at 03:24  AM, Damian Conway wrote:

Michael Lazzaro asked:

   class FileBasedHash is Hash { ...stuff... };
   my %data is FileBasedHash('/tmp/foo.txt');

Yes.



   my $path = '/tmp/foo.txt';
   my %data is FileBasedHash($path);

Indeed


Great -- then I have only one more question, I think.  In the words of 
a certain cartoon character, what's *this* button do?

  my $b is $a;

My presumption:

1) If C, e.g. $a is set to a class name, it's saying 
that $b is implemented by a MyScalar.  But I don't know if these two 
lines would really have the same result, given rule (2), below:

 $a = MyScalar;
 $a = 'MyScalar';

2) If C, e.g. it's set to an arbitrary object 
instance, it's saying that $b is implemented by the object instance in 
$a.  So these statements are equiv:

 my $a = FileBasedHash.new($path);
 my %b is $a;
  vs.
 my %b is FileBasedHash($path);

If the object in $a doesn't implement the Scalar interface, it's a 
runtime error.  And note that C would be a runtime error, 
one would hope.


MikeL

(My original gut desire was that C be the ultracool perl6 
way of achieving prototype-based (classless) OO, such that $b inherits 
its base functionality from $a.  As inherently cool as that is, I don't 
think that can possibly work, and it would conflict *severely* with 
these other meanings.  Ah, well.)



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Austin Hastings

--- attriel <[EMAIL PROTECTED]> wrote:
> Ah.  OK, thanks :)  I had the basic idea, but I wasn't sure how to
> tell in perl which parameter was the indirect object :o

Right, "o" in your sentence above is the object. 

> if I'm following this right, it's the inferred object such that (in
> p5) if I called I.hit(him) the sub would receive @_ = I, him; yes?

Yep.

> and thus it would be hit (him) <~ I; in the current thread?

Yep.  

Henceforth, <~ shall be the "dragon operator", because (1) you're
draggin' the object back to the method; and (2) operator:<~ looks like
a chinese dragon.

Likewise, ~> shall be the "grin operator", because of the smiley in
"operator:~>".

=Austin




Re: Array Questions

2003-01-10 Thread Jonathan Scott Duff
On Fri, Jan 10, 2003 at 10:28:49AM -0800, Michael Lazzaro wrote:
> Great -- then I have only one more question, I think.  In the words of 
> a certain cartoon character, what's *this* button do?
> 
>my $b is $a;

And no matter what that button does, will this:

my $a $b;

be illegal?

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Andrew Rodland
On Friday 10 January 2003 11:42 am, Paul Johnson wrote:
> Damian Conway said:
> > Andy Wardley wrote:
> >> The arrow is a special case.  I don't read that first character
> >> as '-', I think of the operator as one.  I guess the visual cue forces
> >> me to see it like that.
> >
> > I'm suggesting that ~> and <~ will be the same.
>
> I think that in part this may depend on the font being used.

True. It looks horrid in misc-fixed-* (what I'm assuming Paul has in his 
xterm).




RE: Array Questions

2003-01-10 Thread Thom Boyer
From: Michael Lazzaro [mailto:[EMAIL PROTECTED]]
> But I don't know if these two 
> lines would really have the same result, ...
>
>  $a = MyScalar;
>  $a = 'MyScalar';

Hrmm. Didn't Larry decree that there are no bare words, but that a class
name will evaluate to the string representing the spelling of the class
name? In otherwords, aren't those two assignments identical by definition?
=thom
"Never try to out-stubborn a cat." --Lazarus Long 



RE: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Thom Boyer
Paul Johnson <[EMAIL PROTECTED]> wrote:
> When I later saw it using mutt in an xterm, the tilde was at the top of
> the character, where I was more used to seeing it and it didn't look like
> an arrow any more, nor did it look very good to me.

Well, at least now I understand why some people didn't see the squiggly
arrow immediately, as I did. It seemed so obvious to MY eyes, I couldn't
understand what the big deal was.

I have been (quietly) siding with the "let's use unicode characters as
operators" camp. But this little brouhaha has me splitting into two
universes:

  Universe 1 (anti-unicode): "If we have this much trouble seeing a tilde
the same way, what are the chances that all these cool new operators will be
visually comparable to all P6 coders?"

  Universe 2 (pro-unicode): "If we had a Unicode 'squiggly arrow' operator,
then however it looks on everybody's display, it ought to at least look like
some kind of squiggly arrow."

We'll say goodbye now.
=thom
"Delusions are often functional. A mother's opinions about her children's
beauty, intelligence, goodness et cetera ad nauseam, keep her from drowning
them at birth." --Lazarus Long 



RE: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Thom Boyer
Andrew Rodland <[EMAIL PROTECTED]> wrote:
> But you're missing the most important part!
> I propose that these operators should be named "gozinta" ( ~>) 
> and "comezouta" ( <~ ), just so that we can say that perl has them. Not to

> mention that the names work pretty well, for me. 

Here, here! All in favor, say "Aye"!

'Course, then I've gotta explain why
  $x = 7 ~> 63;
doesn't evaluate to 9 

:-)

=thom
"Be wary of strong drink. It can make you shoot at tax collectors...and
miss." --Lazarus Long



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Luke Palmer
> Date: Fri, 10 Jan 2003 08:12:48 -0800 (PST)
> From: Austin Hastings <[EMAIL PROTECTED]>
> 
> --- attriel <[EMAIL PROTECTED]> wrote:
> > Could someone explain how to know what's the indirect object?  (who
> > knew
> > the "sentence diagramming" would be USEFUL!!)
> 
> Short version:
> 
> If there's two people in the sentence, the verb-ee is either the direct
> or indirect object. If there's two people and a thing, the -ee is
> indirect.
> 
> I hit him. (He's the direct object.)
>
> I gave the ball to him. (Ind.)
> 
> In reality, the reference to "indirect object" is a bogus equivalence,
> because we're really making the SUBJECT of the sentence, as

And the one we're modeling it after in Perl is:

  I gave him the ball.

In Perl 6:

  gave him: the ball;

But a better sentence to use as an example here would be a command, as
most imperative (computer) languages use:

  Give the ball to him.

Or equivalently,

  Give him the ball.

In Perl 6:

  give him: the ball;

And as you can see, it is no longer a misnomer.  The subject is
implicitly "you" or (in a Star Trek sense) "computer".

> hit him :I
> 
> becomes
> 
> I.hit(him)

I don't think so.  Rather, that becomes:

  him.hit(I);

And to clarify, you should probably format it like this:

  hit him: I;

But computer languages aren't generally used to specify past tense
anyway

To summarize, the indirect object goes I the verb and the
direct object, before the colon.

Luke



Re: Array Questions

2003-01-10 Thread Luke Palmer
> From: Thom Boyer <[EMAIL PROTECTED]>
> Date: Fri, 10 Jan 2003 13:57:26 -0700
> 
> From: Michael Lazzaro [mailto:[EMAIL PROTECTED]]
> > But I don't know if these two 
> > lines would really have the same result, ...
> >
> >  $a = MyScalar;
> >  $a = 'MyScalar';
> 
> Hrmm. Didn't Larry decree that there are no bare words, but that a class
> name will evaluate to the string representing the spelling of the class
> name? In otherwords, aren't those two assignments identical by definition?

You're correct in that there are no barewords.  But, IIRC, a class
name doesn't just evaluate to a string representing the spelling of
the class name.  Classes are first-class objects in Perl 6, just as
subroutines were in Perl 5.

The two variables would only behave the same in certain situations
because of symbolic dereferencing.  But, they couldn't go by name,
because then what would $foo be here:

   $foo = class { has $.bar is public };

As far as the example:

   $a = MyScalar;
   $b = $a is $a;

(Or something like that)  I would imagine that would only work if $a
was known at compile time:

   BEGIN { $a = MyScalar; }
   $b = $a is $a;

Maybe.  Actually, that's quite a difficult question; is MyScalar a
property or a behavior class?  Is there a difference, or is the latter
a subset of the former?

But, AFAIK, the two statements are not equivalent.

Luke



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Andy Wardley
Paul Johnson wrote:
> When I later saw it using mutt in an xterm, the tilde was at the top of
> the character, where I was more used to seeing it and it didn't look like
> an arrow any more, nor did it look very good to me.

Ah yes, that's the problem.  On all my fonts, the tilde appears at
the top and it doesn't look anything like an arrow.

Viewing it on a web browser with the tilde centered vertically does
indeed bring out the arrow-ness of it.

A




Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Paul Johnson
On Fri, Jan 10, 2003 at 03:55:30PM -0500, Andrew Rodland wrote:
> On Friday 10 January 2003 11:42 am, Paul Johnson wrote:
> > Damian Conway said:
> > > Andy Wardley wrote:
> > >> The arrow is a special case.  I don't read that first character
> > >> as '-', I think of the operator as one.  I guess the visual cue forces
> > >> me to see it like that.
> > >
> > > I'm suggesting that ~> and <~ will be the same.
> >
> > I think that in part this may depend on the font being used.
> 
> True. It looks horrid in misc-fixed-* (what I'm assuming Paul has in his 
> xterm).

-bitstream-courier-* actually, now that I can check, but the effect is
the same.

Maybe someone can cook up a Perl font that we can recommend to anyone
who needs to see the source?

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Mark J. Reed
Let me just chime in here that I have been reading all the
messages via mutt in an xterm font in which the
tilde is at the top of the space, and this has in no way
affected my appreciation of the new operators.

I don't want them to look like arrows, because that's reminiscent
of ->, which is misleading as to the direction of data flow.
Visually, I think of <~ and ~> as modifications of the shell redirect
operators, which works very well.


-- 
Mark REED| CNN Internet Technology
1 CNN Center Rm SW0831G  | [EMAIL PROTECTED]
Atlanta, GA 30348  USA   | +1 404 827 4754



Re: L2R/R2L syntax (was Re: Everything is an object.)

2003-01-10 Thread Damian Conway
I don't know about *your* font, but in mine the ~> and <~ versions are
at least twice as readable as the |> and <| ones.

 
Just out of curiosity, how did you measure that? ;-)

Well, obviously, I used the Symbol::Readability module:

	module Symbol::Readability;

	sub delta_r(Str $a, Str $a) returns Int is exported {
	return sum [»ord«split//,$x] »-« [»ord«split//,$y]
	}

and then:

	#! /usr/bin/perl6

	use Symbol::Readability;

	print delta_r('~>','|>');



How else?

;-)

Damian