final is b0rk b0rk b0rk

php.internals

Sterling Hughes

23 years ago
<?php class foo { final public $bar = 10; } $f = new foo; $a = 'bar'; $f->$a = 20; echo $f->bar; ?> outputs : 20 Final needs to be runtime. -Sterling PS: Insert mention of how this feature doesn't belong in a language like php here. Also mention that interfaces/abstract suffer from the same problem, and should be removed for the same reason.
-- "People can have the Model T in any colour -- so long as it's black." - Henry Ford

Mike Robinson

23 years ago
Sterling Hughes wrote:
> <?php > class foo { > final public $bar = 10; > } > > $f = new foo; > $a = 'bar'; > $f->$a = 20; > echo $f->bar; > ?>
[b0rk3d output snipped]
> > PS: Insert mention of how this feature doesn't belong in a language like > php here. Also mention that interfaces/abstract suffer from the same > problem, and should be removed for the same reason.
+1 for removing _all_ that stuff. :P Best Regards Mike Robinson

George Schlossnagle

23 years ago
On Friday, April 18, 2003, at 02:51 PM, Mike Robinson wrote:
> Sterling Hughes wrote: >> >> PS: Insert mention of how this feature doesn't belong in a language >> like >> php here. Also mention that interfaces/abstract suffer from the same >> problem, and should be removed for the same reason. > > +1 for removing _all_ that stuff. :P
I like that stuff. I think interfaces in particular are useful for ensuring object model conformance. I actively use similar features in Perl (where they are certainly rougher in implementation), and they are useful.

(Marcus Börger)

23 years ago
At 20:51 18.04.2003, Mike Robinson wrote:
>Sterling Hughes wrote: > > <?php > > class foo { > > final public $bar = 10; > > } > > > > >[b0rk3d output snipped]
I don't see a reason or sense in "final" for properties. IMO it is only in there by mistake.
> > > > PS: Insert mention of how this feature doesn't belong in a language like > > php here. Also mention that interfaces/abstract suffer from the same > > problem, and should be removed for the same reason. > >+1 for removing _all_ that stuff. :P
Final and interfaces are ways to express aspects of an oo model. When working in big projects you'll get used to such. If not feel free to ignore the feature just like any other feature you dislike in php, too. regards marcus

Mike Robinson

23 years ago
Marcus Borger wrote:
> Final and interfaces are ways to express aspects of an oo model. > When working in big projects you'll get used to such. If not feel free > to ignore the feature just like any other feature you dislike in php, too.
LOL. Relax there Marcus. :) It _is_ a feature, and I'm sure I and perhaps 33 other people on the planet may find ample use for it, but by and large this sort of stuff leans away from the 'simple solutions to common problems' premise of php. No big deal, just that Sterling is one of only a few who actually speaks up about stuff like this, so I wanted to encourage that because a) there's not enough of it going on and b) what little that does occur is generally ignored. And _THAT_ is about the only feature of PHP I dislike right now, but since it's undocumented I'll consider it a bug that can be fixed. Best Regards Mike Robinson