Re: is $[ really deprecated?
On Wed, Aug 03, 2005 at 06:04:44PM -0700, Michael G Schwern wrote: On Thu, Aug 04, 2005 at 12:26:32AM +0200, Abigail wrote: What would the gain be if you remove $[? The ponie guys might find it useful not having to implement it. Nick? Er, mmm. It's probably easier leaving it in. Taking it out would simplify the PMC(s) that replace AVs Taking it out would increase the amount of fork between ponie and 5.9 Nicholas Clark
Re: is $[ really deprecated?
On 8/8/05, Nicholas Clark [EMAIL PROTECTED] wrote: On Wed, Aug 03, 2005 at 06:04:44PM -0700, Michael G Schwern wrote: On Thu, Aug 04, 2005 at 12:26:32AM +0200, Abigail wrote: What would the gain be if you remove $[? Taking it out would simplify the PMC(s) that replace AVs depending on the implementation details. In a scenario where a set $[ causes adjustment to all AV lookups within its lexical scope, at compile time, $[ could be implemented as a compile-time adjustment. All instances of $A[index_expression] become $A[(index_expression) - $[ ] during a compile-time step, and the PMC virtual table for the AV can always have a base of 0, and the backwards-compatbility pragma to bring $[ back can snag array indexing at compile time and insert its adjustment. I had thought that is how 5 has done it since $[ stopped being a distance-effective global, but I expect I was wrong in that. perldoc perlvar says, of course As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly discouraged. Note that, unlike other compile-time directives (such as strict), assignment to $[ can be seen from outer lexical scopes in the same file. However, you can use local() on it to strictly bound its value to a lexical block. end quote Would anyone mind if a file that used $[ had to have a use $[; or use variable_array_bottom; in it before $[ use? Although that would be work for dubious if any gain.
Re: is $[ really deprecated?
On 8/8/05, David Nicol [EMAIL PROTECTED] wrote: On 8/8/05, Nicholas Clark [EMAIL PROTECTED] wrote: On Wed, Aug 03, 2005 at 06:04:44PM -0700, Michael G Schwern wrote: On Thu, Aug 04, 2005 at 12:26:32AM +0200, Abigail wrote: What would the gain be if you remove $[? Taking it out would simplify the PMC(s) that replace AVs depending on the implementation details. In a scenario where a set $[ causes adjustment to all AV lookups within its lexical scope, at compile time, $[ could be implemented as a compile-time adjustment. All instances of $A[index_expression] become $A[(index_expression) - $[ ] during a compile-time step, and the PMC virtual table for the AV can always have a base of 0, and the backwards-compatbility pragma to bring $[ back can snag array indexing at compile time and insert its adjustment. Actually, $] = 1; eval q/$foo[1]/ is supposed to return the first element of @foo. So you can't completely optimize it out at compile time.
Re: is $[ really deprecated?
On Mon, Aug 08, 2005 at 12:34:37PM -0500, David Nicol wrote: Would anyone mind if a file that used $[ had to have a use $[; or use variable_array_bottom; in it before $[ use? Although that would be work for dubious if any gain. Yes, I think that will be a problem. I expect that the vast majority of the small number of programs that still use $[ are *old* programs, programs that have been doing their work for a long time. If they require 'use $[' or something else, they break, causing frustration. And what will be the gain? It's not that that means $[ no longer needs to be supported. Abigail pgppvlrN9RxPA.pgp Description: PGP signature
Re: is $[ really deprecated?
On 8/8/05, Rafael Garcia-Suarez [EMAIL PROTECTED] wrote: Actually, $] = 1; eval q/$foo[1]/ is supposed to return the first element of @foo. So you can't completely optimize it out at compile time. eval-string does compilation, so yes you can, for sufficiently weak values of completely. -- David L Nicol This has been your one free extra mile
Re: is $[ really deprecated?
On 8/4/05, Abigail [EMAIL PROTECTED] wrote: What would the gain be if you remove $[? Only internal gains. Mostly memory improvements, since each control OP in the optree stores $[ on 32 bytes currently. Also, probably unnoticeable speed improvements (bug integer addition isn't that expensive.) We wouldn't be able to remove $[ before 5.12, and when will that be? 2010? It'll be work to remove it, with the possibility to introduce bugs, it's likely to break some old programs that have been running smootly for years. And it's not that you often see new code using $[. Most true. In fact, I cannot recall ever seeing anyone posting code to Usenet or Perlmonks that used $[ - except code using $[ for the sake of using $[. I'd say, let it rest. It seems to be hardly used anyway. The only chance I'd recommend is to _remove_ mentioning of $[ from the documentation in places like 'index' and 'splice'. Describe $[ in perlvar, mention its use is discouraged, and don't mention it in perlfunc or perldata. Unclutter documentation... that's very un-dan-jacobsonesque, I like this idea.
is $[ really deprecated?
There was some debate about whether $[ is deprecated or not at http://perlmonks.org/index.pl?node_id=480333 . perldata says: Version 5 of Perl changed the semantics of $[: files that don't set the value of $[ no longer need to worry about whether another file changed its value. (In other words, use of $[ is ***deprecated***.) but perlvar says: As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly ***discouraged***. which give slightly different messages. And, certainly, changing $[ does not result in deprecation warnings. Should the wording of either of these documents change? Or should $[ produce deprecation warnings? Or should we stop splitting hairs about this and forget about it? ;-) -- ivan
Re: is $[ really deprecated?
On Wed, 03 Aug 2005 11:05:36 -0400, Ivan Tubert-Brohman [EMAIL PROTECTED] wrote: There was some debate about whether $[ is deprecated or not at http://perlmonks.org/index.pl?node_id=480333 . It is. But indeed, there are no warnings. d3:/u/usr/merijn 103 perl5.6.1 -wle'$[ = 1' d3:/u/usr/merijn 104 perl5.8.0 -wle'$[ = 1' d3:/u/usr/merijn 105 pc09:/home/merijn 110 perl5.8.5 -wle'$[ = 1' pc09:/home/merijn 111 perl5.8.6 -wle'$[ = 1' pc09:/home/merijn 112 perl5.9.2 -wle'$[ = 1' pc09:/home/merijn 113 perldata says: Version 5 of Perl changed the semantics of $[: files that don't set the value of $[ no longer need to worry about whether another file changed its value. (In other words, use of $[ is ***deprecated***.) but perlvar says: As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly ***discouraged***. which give slightly different messages. And, certainly, changing $[ does not result in deprecation warnings. Should the wording of either of these documents change? Or should $[ produce deprecation warnings? Or should we stop splitting hairs about this and forget about it? ;-) -- H.Merijn BrandAmsterdam Perl Mongers (http://amsterdam.pm.org/) using Perl 5.6.2, 5.8.0, 5.8.5, 5.9.2 on HP-UX 10.20, 11.00 11.11, AIX 4.3 5.2, SuSE 9.2 9.3, and Cygwin. http://www.cmve.net/~merijn Smoking perl: http://www.test-smoke.org,perl QA: http://qa.perl.org reports to: [EMAIL PROTECTED],perl-qa@perl.org
Re: is $[ really deprecated?
On 8/3/05, Ivan Tubert-Brohman [EMAIL PROTECTED] wrote: perldata says: Version 5 of Perl changed the semantics of $[: files that don't set the value of $[ no longer need to worry about whether another file changed its value. (In other words, use of $[ is ***deprecated***.) In other words, in now (in perl 5) a pragma. but perlvar says: As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly ***discouraged***. which give slightly different messages. And, certainly, changing $[ does not result in deprecation warnings. perlvar is correct. Should the wording of either of these documents change? Or should $[ produce deprecation warnings? Or should we stop splitting hairs about this and forget about it? ;-) $[ is a pain when you come across it in the perl internals. It's not deprecated yet, and I see no compelling reason to begin a deprecation cycle and introduce new warnings; but I'm not completely against it either.
Re: is $[ really deprecated?
On Wed, Aug 03, 2005 at 10:45:28PM +0200, Rafael Garcia-Suarez wrote: On 8/3/05, Ivan Tubert-Brohman [EMAIL PROTECTED] wrote: perldata says: Version 5 of Perl changed the semantics of $[: files that don't set the value of $[ no longer need to worry about whether another file changed its value. (In other words, use of $[ is ***deprecated***.) In other words, in now (in perl 5) a pragma. but perlvar says: As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly ***discouraged***. which give slightly different messages. And, certainly, changing $[ does not result in deprecation warnings. perlvar is correct. Should the wording of either of these documents change? Or should $[ produce deprecation warnings? Or should we stop splitting hairs about this and forget about it? ;-) $[ is a pain when you come across it in the perl internals. It's not deprecated yet, and I see no compelling reason to begin a deprecation cycle and introduce new warnings; but I'm not completely against it either. What would the gain be if you remove $[? We wouldn't be able to remove $[ before 5.12, and when will that be? 2010? It'll be work to remove it, with the possibility to introduce bugs, it's likely to break some old programs that have been running smootly for years. And it's not that you often see new code using $[. In fact, I cannot recall ever seeing anyone posting code to Usenet or Perlmonks that used $[ - except code using $[ for the sake of using $[. I'd say, let it rest. It seems to be hardly used anyway. The only chance I'd recommend is to _remove_ mentioning of $[ from the documentation in places like 'index' and 'splice'. Describe $[ in perlvar, mention its use is discouraged, and don't mention it in perlfunc or perldata. Abigail pgpymnVcltKQc.pgp Description: PGP signature
Re: is $[ really deprecated?
On Thu, Aug 04, 2005 at 12:26:32AM +0200, Abigail wrote: What would the gain be if you remove $[? The ponie guys might find it useful not having to implement it. Nick? -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern Just call me 'Moron Sugar'. http://www.somethingpositive.net/sp05182002.shtml