Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

about 'use less'

by pg (Canon)
on Mar 26, 2003 at 17:11 UTC ( #245999=perlmeditation: print w/replies, xml ) Need Help??

I knew that we had a ‘less’ pragmas in Perl 5.8, but it was only yesterday something triggered me to really think about it.

The current version of document on this pragmas is really simple, and the feature itself is not implemented. It seems like there is not much chance for anyone to comment on it. However one thing I noticed is that, it is stated that this pragmas would be used by the compiler to determine certain trade offs base on the user’s wish, and the wording clearly indicates that their intention is that this pragmas would only be used by the compiler, not anyone else, at least base on their current mind set.

Now what I am thinking is that, instead of making it something solely belongs to the compiler, it would be much better if they can actually make it an open interface, so that anyone and everyone wish to contribute modules to Perl, would be able to retrieve those ‘less’ configurations set by users really easily, and adjust the behavior of their modules accordingly.

For example, if I am writing a module abc, and there was this method xyz, I can either make it using more memory to gain speed, or make it using less memory, if speed is not a concern. How do I know the user’s wish? Currently there is no way, but in the future, if the ‘less’ pragmas is open, which means I can retrieve the user settings thru a certain way, then I can go ahead use more memory for speed, if the user does not specify ‘use less memory’, or I should rather use less memory, if the user specifies ‘use less memory’.

Replies are listed 'Best First'.
Re: about 'use less'
by perrin (Chancellor) on Mar 26, 2003 at 18:12 UTC
    I was under the impression that this feature was kind of a pipe dream. If you have a situation where this would be immediately useful to you, write a custom import() method in your module that will take arguments, like this:
    use PG::Module qw(less_memory);
      perrin, I don’t need this feature immediately, this is simply a dream on top of another dream, and hoping the 1st dream be more wonderful.

      However, I really love your idea. It is a good suggestion to anyone who wants the feature now. Thank you very much.
Re: about 'use less'
by MZSanford (Curate) on Mar 27, 2003 at 15:19 UTC

    I know this is dirty, and incomplete. You can check %INC to see if less has been used (just not how). I do agree a good use for less would be something like a @less::requested var to let modules check what was requested less of. This would allow for a standard interface rather than an qw(less_memory) here and a qw(lite) there. Something a bit more standard, and a little less author's choice. Not that this comes up often, but when else do a half dozen line make such a diffrence ?

    Just my €0.02

    from the frivolous to the serious

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://245999]
Approved by abell
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-06-17 23:01 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.