[% setvar title Request For New Pragma: Implicit %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

Request For New Pragma: Implicit

VERSION

  Maintainer: Bryan C. Warnock <bwarnock@gtemail.net>
  Date: 5 Aug 2000
  Last Modified: 28 Aug 2000
  Mailing List: perl6-language@perl.org
  Number: 2
  Version: 3
  Status: Frozen

ABSTRACT

Perl 6 should add a new pragma called implicit.

DESCRIPTION

I am lazy. I am spoiled by the implicit $_. I like the implicit $_. Implicit $_ good. Ugh. (Conversely, some people abhor the implicit $_ while in a strict programming environment, as it tends to add confusion.)

I 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. print could be written like ?. It just rolled off the fingers. 10 ?"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. (Like I posted in a response, I wrangled an input filter to allow me to write ? "Print me.!".

But I digress.

There should be an implicit 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 have 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.

Or, from reading the traffic, to prevent laziness. One of the suggestions was to disallow implicit $_ for functions. That could fit right in with this pragma. It would be on be default, but you could turn it off.

MOTIVATORS

Laziness, pure and simple.

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.

In the case of no implicit arg, the front-end would have to not assume the implicit $_ as an argument.

SUMMARY OF IMPLEMENTATION

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

IMPACT

UNKNOWNS

REFERENCES

RFC 40: Module Scope Control.

STATUS

Frozen as is. Most people don't like it. I don't like it. Not really. I hate to think that Perl will have more pragmas than functions at the current pace.

But I like the idea behind it. I think a smarter solution would be found in something akin to "RFC 40". In which case, I would gladly withdraw it.