lines of code in perl vs. c 
Author Message
 lines of code in perl vs. c

:

:
: > As Larry has said in this forum before, what's all the objection to
: > having a reserved character denote scalar variables (or any type of
: > variable, for that matter)?
:
: IMHO, the objection is against the special variables, whose names do
: have some resemblance to modem noise. Although a number of them can be
: avoided if you like (e.g. $_, $` and friends) you still need access to
: $!, $=, $^ etc. if you need the associated functionality.

You should be able to alias any of them using the *foo dohickies:

        *format         = *~;
        *previous       = *`;
        *errno          = *!;

        *num_format     = *#;
        *pid            = *$;
        *page_num       = *%;
        *top_of_form    = *^;
        *matched        = *&;
        *multiline      = **;
        *rgids          = *(;
        *egids          = *);
        *lines_left     = *-;
        *default        = *_;
        *page_lines     = *=;
        *last_substr    = *+;
        *array_base     = *[;
        *version        = *];
        *outrecsep      = *\;
        *cmd_buffered   = *|;
        *multikey_sep   = *;;
        *breakables     = *:;
        *subsequent     = *';
        *array_delim    = *";
        *out_field_sep  = *,;
        *ruid           = *<;
        *linenumber     = *.;
        *euid           = *>;
        *in_rec_sep     = */;
        *status         = *?;
        *debug          = *^D;
        *max_sys_fd     = *^F;
        *inplace        = *^I;
        *perl_db        = *^P;
        *basetime       = *^T;
        *warn           = *^W;

: Personally, I would not mind something like an internal package:
:
:     print STDERR "Error: cannot open $file, reason: $Perl'LastError\n";
:
: or even pseudo packages:
:
:     $STDOUT'TopOfForm = "std_top"; $STDOUT'Form = "std_out";
:     $STDERR'Buffered = 1;
:
: Although a little bit harder to write, this would increase readability
: and maintainability a lot.

That'd be nice, but would require some fixes to perl itself, I think.
Admittedly, the semantics of per-filehandle variables is a low spot,
for mostly historical reasons.

You could probably work something out using packaged subroutines, like some
of the stuff Tom has been doing:

    &STDOUT'out_rec_sep("\n");

Instantiating generic packages would require an eval of a double-quoted
string, though.

Larry



Sun, 03 Apr 1994 02:59:01 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 
 

 
Powered by phpBB® Forum Software