Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I mainly agree with the objections to lvalue subs as an OO mechanism. They impose a syntax which exposes the implementation, and they allow direct accesss to data to be exported. As you say, constraint checking is not possible.

The lvalue attribute means that the represented value is modifiable, not just assignable. Consider the following:

{ my $foo = 'boo' . $/; sub foo () : lvalue { $foo } } chomp foo; foo =~ s/o/r/; print foo;
What will your visible future foo be in these cases? Your proposals all seem to require that the lvalue sub know a lot about the operators that bind it. It appears that that will produce a very heavy and baroque kind of attribute.

I think that the lvalue attribute should be retained as the overloading mechanism that it is, and its use for exporting data recognized for its own properties. The fact that it is unsuitable for strict OO does not make it useless or harmful.

After Compline,
Zaxo


In reply to Re: What the [sub]in 'L value do they have? by Zaxo
in thread What the [sub]in 'L value do they have? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-06-22 02:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (100 votes). Check out past polls.

    Notices?