Re: RFC 2 (v1) Request For New Pragma: Implicit

2000-08-04 Thread Bart Lateur

On 03 Aug 2000 22:23:08 -0400, Chaim Frenkel wrote:

What would be the method to _avoid_ emitting something?

What would be the result of

   open(Foo, "Bar")# Prints FILEHANDLE=0xdeadbeef
   $x++;   # Prints 3

Exactly. I can think of even more cases:

 * What do you do with the "true" value at the end of a module/required
file? Some people make a habit of putting a string there, instead of
just the boring "1;".

 * How about bare strings as a return value from a sub? Example:

sub test {
"This string gets printed\n";
"This is the return value.\n";
}

Then:

$a = test();

would only print the first string, assigning the second string to $a,
and

test();

would (probably) print both strings, because test() is called in a void
context, which would be inherited by the return value string. I say
"probably", because this statement might be the last statement in a
sub...

I think it's a bad idea. I would rather do it as the C64 did: use a very
short function name as an alternative to "print".

P "This gets printed!", "\n", "Yeah!\n";

Unfortunately (for you), you can't use '?' because it would be ambiguous
WRT the ?PATTERN? syntax.

-- 
Bart.



Re: RFC 2 (v1) Request For New Pragma: Implicit

2000-08-04 Thread Tim Jenness

On Fri, 4 Aug 2000, Bart Lateur wrote:

 I think it's a bad idea. I would rather do it as the C64 did: use a very
 short function name as an alternative to "print".
 
   P "This gets printed!", "\n", "Yeah!\n";
 

Just like perldl already allows(but that's an intereactive shell so we
try to reduce common typing as much as possible).

-- 
Tim Jenness
JCMT software engineer/Support scientist
http://www.jach.hawaii.edu/~timj





Re: RFC 2 (v1) Request For New Pragma: Implicit

2000-08-03 Thread Chaim Frenkel

What would be the method to _avoid_ emitting something?

What would be the result of

open(Foo, "Bar")# Prints FILEHANDLE=0xdeadbeef
$x++;   # Prints 3

What makes something a 'real' void so that it would print. Vs. not
having something that would catch the return value?

chaim
-- 
Chaim FrenkelNonlinear Knowledge, Inc.
[EMAIL PROTECTED]   +1-718-236-0183



RFC 2 (v1) Request For New Pragma: Implicit

2000-08-02 Thread Perl6 RFC Librarian

=head1 TITLE

Request For New Pragma: Implicit

=head1 VERSION

Maintainer: Bryan C. Warnock [EMAIL PROTECTED]
Date: 01 Aug 2000
Version: 1
Mailing List: [EMAIL PROTECTED]
Number: 2

=head1 ABSTRACT

Perl 6 should add a new pragma called Cimplicit.

=head1 DESCRIPTION

I am lazy.  I am spoiled by the implicit $_.  I like the implicit
$_.  Implicit $_ good.  Ugh.

I also came to the sysadm / programming world in a long, circuitous
route.  I never programmed with toggle switches.  I've never seen a 
punch card.  My first programming was in Commodore 64 Basic.

C64 Basic.  No safe-signals there, either.  ;)

It did have one good thing, though.  One very useful thing, for lazy
people like me.  Cprint could be written like C?.  It just
rolled off the fingers.  C10 ?"Port Perl for the 64!".

Of course, those days have gone.  I've seen the light.  I'm a *nix
head and JAPH.  But how I still hate typing out print.  Particularly
because I do it so much.  Oh, sure, I could play games with HERE docs 
and the ilk, but I'm too lazy.

But I digress.  

There should be an Cimplicit pragma that gives new life and meaning to
void context constructs.  In my case, I want it to print to the default
filehandle, (which is also implicit, I might add.)

Scoping needs to be tightly controlled, of course.  Don't want someone 
else's void context to show up on your display, now do you?  And, of course, 
it would be defaulted to off.  It could continue to ignore constant 0s and 
1s.  (But those pre-pod embedded comment strings just Bhave to go.)

Ideally, I'd like to use it for printing, but I suppose some other lazy
person may want to use it for something else.

=head1 MOTIVATORS

Laziness, pure and simple.

=head1 IMPLEMENTATION

The front-end would have to detect void usage and either arrange to have
the results passed to a callback, (in which case, would you know what
wantarray() wants to know?) or inject the appropriate term in the
optree.

=head2 SUMMARY OF IMPLEMENTATION

I've no real concrete ideas on this, sorry.

=head2 IMPACT

=over 4

=item *

Impact on Perl 5.  Mutual compatibility between Perl 5 and Perl 6, with the
exception of Cuse implicit and the sematics it would add.  (Obviously, 
other changes to the language notwithstanding.)

=back

=head2 UNKNOWNS

=over 4

=item *

What about subs?  Backticks?  Things that return meaningless printable
information, like system()?

Cno implicit would put it on the user.  After all, he doesn't have to
use it.

=item *

Would C; print the contents of $_ to the default filehandle?  ;-)

=back

=head1 REFERENCES

   None, currently.