Re: Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
On Thu, Sep 28, 2000 at 10:00:49AM -0400, Andy Dougherty wrote: On Wed, 27 Sep 2000, Nathan Wiger wrote: Y'know, I couldn't have said this better myself. :-) I've always felt that "use English" was a waste of time and effort, a bandaid trying to act as a tourniquet. I think it's a nice little bit of optional sugar and I don't see any reason to throw it away. The key point is that it's optional. If you think it's a waste of time and effort, don't use it. If other people use it, well... does Perl stop people programming in ways you don't like? -- It is better to wear chains than to believe you are free, and weight yourself down with invisible chains.
Re: Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
Andy Dougherty [EMAIL PROTECTED] writes: I find that I don't remember many of the less-frequently-used perlvars (where less-frequently-used depends on the types of programs I write, obviously). I certainly couldn't tell you off-hand the differences among $ $ $( and $). I'd have to look them up. I never understood why these were variables. You don't change UIDs or GIDs that often, and when you do you tend to want precise control and because they're variables, they have weird interaction semantics and you have to assign to them in just the right order to get done what you want to get done. See recent threads on comp.lang.perl.moderated. I'd honestly rather see getuid, geteuid, getgid, getegid, and getgroups, along with some consistent and complete subset of the setting functions (with portability magic behind the scenes), in a separate module that only those programs that need to do UID fiddling need to load. I guess the exception is getpwuid($), which is probably done more than any other operation on UIDs, but maybe just keep that single variable. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/
Re: Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
Simon Cozens wrote: On Thu, Sep 28, 2000 at 10:00:49AM -0400, Andy Dougherty wrote: On Wed, 27 Sep 2000, Nathan Wiger wrote: Y'know, I couldn't have said this better myself. :-) I've always felt that "use English" was a waste of time and effort, a bandaid trying to act as a tourniquet. I think it's a nice little bit of optional sugar and I don't see any reason to throw it away. The key point is that it's optional. If you think it's a waste of time and effort, don't use it. If other people use it, well... does Perl stop people programming in ways you don't like? I agree with you. That's why I'd never RFC that we should lose it.* I was just voicing my opinion that I personally think it's a waste. But that doesn't mean others don't like it. ;-) -Nate * assuming it doesn't harm the language, which it doesn't currently
Re: Perl6Storm: Intent to RFC #0101
./sun4-solaris/POSIX.pm:sub isatty { ./sun4-solaris/B/Deparse.pm:sub is_scope { ./sun4-solaris/B/Deparse.pm:sub is_state { ./sun4-solaris/B/Deparse.pm:sub is_miniwhile { # check for one-line loop (`foo() while $y--') ./sun4-solaris/B/Deparse.pm:sub is_scalar { ./sun4-solaris/B/Deparse.pm:sub is_subscriptable { ./CGI.pm:sub isindex { ./CPAN.pm:sub is_reachable { ./CPAN.pm:sub isa_perl { ./Pod/Select.pm:sub is_selected { ./ExtUtils/Embed.pm:sub is_cmd { $0 eq '-e' } ./ExtUtils/Embed.pm:sub is_perl_object { Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
Re: Perl6Storm: Intent to RFC #0101
You suggested: file($file, 'w'); # is it writeable? That's really insane. The goal was to produce code that's legible. That is hardly better. It's much worse than is_writable or writable or whatnot. Just use -w if that's what you want. --tom Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments.
Re: Perl6Storm: Intent to RFC #0101
You suggested: file($file, 'w'); # is it writeable? Not that I'm advocating it but you do something like: test($file, WRITEABLE); test($file, WRITEABLE READABLE); ... where constants are defined for various "attributes" to be tested for... Currently 23, or 3 bytes... (not that it matters ;-) This seems rather readable and less (name-space) cluttery, and if it suits you it could be named ftest or somesuch... Hell you could even make it magical and allow the -X switched enlieu of constants... Where use English would be required to get the constants. -- #!/usr/bin/perl -nl BEGIN{($,,$0)=("\040",21);@F=(sub{tr[a-zA-Z][n-za-mN-ZA-M];print;}); $_="Gnxr 1-3 ng n gvzr, gur ynfg bar vf cbvfba.";{$F[0]};sub t{*t=sub{}; return if rand().5;$_="Vg'f abg lbhe ghea lrg, abj tb.";{$F[0]};$_=0;} sub v{print map sprintf('%c', 2**7-2**2),(1 .. $0);}v;}{$_++;$_--;$_||=4; if($_2||($_212)){$_="Vainyvq ragel";{$F[0]};last;}t;$0-=$_;$_="Lbh jva"; die({$F[0]}) if !($0-1);$0-=$0%2?$02?2:1:$0=5?$02?3:1:rand.5?1:3; $_="V jva";die({$F[0]}) if !($0-11);}v __END__ http://pthbb.org/ MOTD on Setting Orange, the 51st of Bureaucracy, in the YOLD 3166: No, just the nipple-cones, officer, just the nipple-cones.
Re: Perl6Storm: Intent to RFC #0101
Robert Mathews [EMAIL PROTECTED] writes: Nathan Wiger wrote: How many people really "use English" other than beginners? I would use it, but I heard a nasty rumor that it incurs the same penalty as using $' and such. I try to avoid too much line noise in code that has to be maintained. I have a very serious problem with use English, namely that it makes Perl code much more difficult to read and maintain for people who know Perl. Writing something that's marginally easier to understand for a beginner and harder to understand for an expert doesn't strike me as a good idea. I know what $/ does; I double-take at $INPUT_RECORD_SEPARATOR and am never sure whether it's a user's personal global variable or $/ or some other thing. And $ARG and $MATCH both really look like global variables to me and I'd hunt through the program trying to find where they're defined for a while before realizing they're weird use English things. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/
Re: Perl6Storm: Intent to RFC #0101
Russ Allbery wrote: I have a very serious problem with use English, namely that it makes Perl code much more difficult to read and maintain for people who know Perl ... and don't know use English. Why can't they learn to use it? Are you saying that nothing is worth knowing unless the oldsters know it already? It's not that I want to jam English down everyone's throats. But Nate asked, "does anyone want this," and I said, "yes." Or at least, I would want it if it worked. I know what $/ does; I double-take at $INPUT_RECORD_SEPARATOR and am never sure whether it's a user's personal global variable or $/ or some other thing. And $ARG and $MATCH both really look like global variables to me and I'd hunt through the program trying to find where they're defined for a while before realizing they're weird use English things. You'd learn to recognize the long variable names if you used English regularly. It's a chicken-and-egg problem, but not a very difficult one. -- Robert Mathews Software Engineer Excite@Home
Re: Perl6Storm: Intent to RFC #0101
Russ Allbery wrote: I have a very serious problem with use English, namely that it makes Perl code much more difficult to read and maintain for people who know Perl. Writing something that's marginally easier to understand for a beginner and harder to understand for an expert doesn't strike me as a good idea. I know what $/ does; I double-take at $INPUT_RECORD_SEPARATOR and am never sure whether it's a user's personal global variable or $/ or some other thing. And $ARG and $MATCH both really look like global variables to me and I'd hunt through the program trying to find where they're defined for a while before realizing they're weird use English things. Fear not, for soon we will be able to do: use less English; Per RFC 303. This pragma will enable lovely mnemonics, like: prn "Line break after this string". $OLS; /^[A-Z]{3,6}/ { $v = sca rev $MTC }; And they thought Perl was unreadable before... just wait 'til they get a load of this! -- Mike Pastore #!Perl Monk Web Coder [EMAIL PROTECTED] bilogic.org Sys Admin
Re: Perl6Storm: Intent to RFC #0101
Robert Mathews [EMAIL PROTECTED] writes: ... and don't know use English. Why can't they learn to use it? Why can't the new users of Perl learn the real variable names? I guess I don't buy the argument that the real names are harder to learn. Most of them have fairly useful mnemonics, you see them and use them constantly so they become familiar quickly, and most Perl code out there uses them. Are you saying that nothing is worth knowing unless the oldsters know it already? \begin{rant} No, I was not saying that. I was saying exactly what I said. I meant what I said. If I'd meant something else, I would have said that instead. \end{rant} It's not that I want to jam English down everyone's throats. But Nate asked, "does anyone want this," and I said, "yes." Or at least, I would want it if it worked. Hey, I'm not claiming you're trying to jam anything anywhere. We were discussing use English, and I'm expressing my opinion just like you are. I've found the use of use English in code I had to maintain to be annoying and unhelpful, and to actually degrade the maintainability of the code, so I threw in my two cents. You'd learn to recognize the long variable names if you used English regularly. It's a chicken-and-egg problem, but not a very difficult one. I've yet to understand why I'd *want* to use English regularly; so far as I can tell, it has essentially no benefit in the long term. Perl is not now, nor is it likely to ever be, a language that's particularly readable by people who don't know Perl, and use English in order to learn the strange names used by use English strikes me as rather circular. Either the person maintaining the code learns Perl, in which case the use English names won't be necessary, or they don't, in which case they're unlikely to be able to maintain the code anyway. I know it's not the only stance to take, but I prefer to try to make my Perl code very readable by people who know Perl, and encourage people who don't know Perl who are trying to read my code to learn Perl first, or at the same time. There are certainly languages out there that are more readable for people who don't know the language at all than Perl is, but I don't find this a particularly important feature in a language. In those cases where it is, I'd use a language other than Perl. use English doesn't really address the syntactical points of Perl that make it hard to read for someone who doesn't know Perl; it strikes me, and always has struck me, as a bad partial solution to a problem that may not need to be solved and that only makes things more complicated in the long run. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/
Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
Russ Allbery wrote: I've found the use of use English in code I had to maintain to be annoying and unhelpful, and to actually degrade the maintainability of the code [snip] I've yet to understand why I'd *want* to use English regularly; so far as I can tell, it has essentially no benefit in the long term. [snip] I know it's not the only stance to take, but I prefer to try to make my Perl code very readable by people who know Perl, and encourage people who don't know Perl who are trying to read my code to learn Perl first, or at the same time. [snip] use English doesn't really address the syntactical points of Perl that make it hard to read for someone who doesn't know Perl; it strikes me, and always has struck me, as a bad partial solution to a problem that may not need to be solved and that only makes things more complicated in the long run. Y'know, I couldn't have said this better myself. :-) I've always felt that "use English" was a waste of time and effort, a bandaid trying to act as a tourniquet. Using Randal's code: /foo/ print while ; Note that "use English" here does nothing to improve the horribly unreadable - yet beautifully succinct and flexible - syntax that is Perl. My personal feeling is that I'd love "use English" to be expunged from the language altogether - it's unnecessary bloat that only increases the number of mistakes that people can make. But I'm not sure if I have the guts to write that RFC just yet. ;-) -Nate
Re: Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
On Wed, Sep 27, 2000 at 04:39:32PM -0700, Nathan Wiger wrote: My personal feeling is that I'd love "use English" to be expunged from the language altogether - it's unnecessary bloat that only increases the number of mistakes that people can make. But I'm not sure if I have the guts to write that RFC just yet. ;-) Are you talking about the overlong variable names? Aliasing -X is being proposed through a 'use english;' mechanism. Z.
Re: Expunge use English from Perl? (was Re: Perl6Storm: Intent to RFC #0101)
Adam Turoff wrote: On Wed, Sep 27, 2000 at 04:39:32PM -0700, Nathan Wiger wrote: My personal feeling is that I'd love "use English" to be expunged from the language altogether - it's unnecessary bloat that only increases the number of mistakes that people can make. But I'm not sure if I have the guts to write that RFC just yet. ;-) Are you talking about the overlong variable names? Aliasing -X is being proposed through a 'use english;' mechanism. It's a good thing we've got Larry Wall to untie the Gordian knot of perl6. One rfc to add more english, one to take it away. -- Robert Mathews Software Engineer Excite@Home
Re: Perl6Storm: Intent to RFC #0101
Nathan Wiger wrote: In fact, I'd much rather still a more generic function like 'want' that takes a list of things to check: file($file, 'd'); # is it a directory? file($file, 'wd'); # is it a writable directory? if ( all { $_-($file) } \writable, \directory ) { ... :-) -- John Porter
Re: Perl6Storm: Intent to RFC #0101
Adam Turoff [EMAIL PROTECTED] writes: I plan to offer a more formal RFC of this idea. Z. =item perl6storm #0101 Just like the "use english" pragma (the modern not-yet-written version of "use English" module), make something for legible fileops. is_readable(file) is really -r(file) Has unpleasant syntax saying "is_readable". Should be like normal English predicates. Get the idea you do. Is better even the Lisp -p convention! What's wrong with doing it like I (and maybe a few others) speak, and saying "readable(file)"? The "is_" prefix serves only to make predicates impossible to read out, leading to thinkos. [...] -- Ariel Scolnicov|"GCAAGAATTGAACTGTAG"| [EMAIL PROTECTED] Compugen Ltd. |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz 72 Pinhas Rosen St.|Tel: +972-3-7658514 (Main office)`- Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555http://3w.compugen.co.il/~ariels
Re: Perl6Storm: Intent to RFC #0101
Ariel Scolnicov wrote: is_readable(file) is really -r(file) Has unpleasant syntax saying "is_readable". Should be like normal English predicates. Get the idea you do. Is better even the Lisp -p convention! What's wrong with doing it like I (and maybe a few others) speak, and saying "readable(file)"? The "is_" prefix serves only to make predicates impossible to read out, leading to thinkos. Yeah, I tend to agree. PHP does this terribly nastily with crap like is_readable($file); is_executable($file); is_directory($file); Bleeech! Drop the is_ , I agree: readable($file); executable($file); directory($file); In fact, I'd much rather still a more generic function like 'want' that takes a list of things to check: file($file); # does it exist? file($file, 'r'); # is it readable? file($file, 'w'); # is it writable? file($file, 'd'); # is it a directory? file($file, 'wd'); # is it a writable directory? file($file, 'dw'); # same thing Otherwise we run the risk of 200 builtins just to check file types and modes on all the different platforms -Nate
Perl6Storm: Intent to RFC #0101
I plan to offer a more formal RFC of this idea. Z. =item perl6storm #0101 Just like the "use english" pragma (the modern not-yet-written version of "use English" module), make something for legible fileops. is_readable(file) is really -r(file) note that these are hard to write now due to -s(FH)/2 style parsing bugs and prototype issues on handles vs paths.