[PHP-DEV] common issue with version_compare()

2012-07-20 Thread Rasmus Schultz
writing their own... - Rasmus Schultz

Re: [PHP-DEV] common issue with version_compare()

2012-07-20 Thread Rasmus Schultz
1.0.0 and 1.0 are different things. I think the problem is, version numbers are different things to different people - I guess the documentation maybe isn't clear enough on precisely what version numbering scheme it's using. To most people, 1 and 1.0 are the same thing, because they look like

Re: [PHP-DEV] common issue with version_compare()

2012-07-21 Thread Rasmus Schultz
using this particular version-numbering scheme, 1.01 is equal to 1.1 - I don't think that's a bug, because the version-numbers in this version-numbering scheme are integers, not decimals. so I believe this is in fact as correct as it can be, since numbers like 01 should not really be used in this

[PHP-DEV] ReflectionParameter::getClassName() missing

2012-07-26 Thread Rasmus Schultz
I was doing some work with the Reflection API, and I ran into something missing from ReflectionParameter. Turns out, there's no way to get the class-name of a parameter, short of calling getClass() - the problem with that is, there's no way to get the class-name of a parameter without causing the

[PHP-DEV] notes on a couple of RFCs

2012-07-28 Thread Rasmus Schultz
Is this RFC outdated? https://wiki.php.net/rfc/jsonable We have JsonSerializable in 5.4 - this appears to be essentially the same thing? (Should it be moved from draft to implemented, or should it just be removed? It was not implemented with the names used in this RFC.) I was also looking at

[PHP-DEV] missing documentation for use-clause in closures?

2012-08-03 Thread Rasmus Schultz
Is this all the documentation there is for the use-clause for anonymous closures? http://us2.php.net/manual/en/functions.anonymous.php For one, it would be nice to have documentation that explains whether the variables listed in the use-clause are copied/referenced at declaration-time or at

[PHP-DEV] removing an item from an array

2012-08-15 Thread Rasmus Schultz
How come there is no straight-foward obvious way to simply remove a given value from an array? Just look at the number of horrible ways people solve this obvious problem: http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key Shouldn't we have something simple, like:

[PHP-DEV] re: removing an item from an array

2012-08-17 Thread Rasmus Schultz
if(($key = array_search($del_val, $messages)) !== false) { unset($messages[$key]); } Nothing horrible here. I disagree - this is (or should be) a simple, atomic operation... yet, you've got a function-call, an intermediary variable, a boolean test, and an unset statement repeating the

Re: [PHP-DEV] re: removing an item from an array

2012-08-17 Thread Rasmus Schultz
. And it doesn't help make codebases more legible when people come up with 25 different ways to do it. On Fri, Aug 17, 2012 at 5:23 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 08/17/2012 05:21 PM, Rasmus Schultz wrote: if(($key = array_search($del_val, $messages)) !== false) { unset

Re: [PHP-DEV] removing an item from an array

2012-08-20 Thread Rasmus Schultz
: On 16.08.2012, at 0:18, Rasmus Schultz ras...@mindplay.dk wrote: How come there is no straight-foward obvious way to simply remove a given value from an array? Well, this sounds like a reason for creating SplSet class

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Rasmus Schultz
Absolutely, you're right. I have a tendency to get dragged into those. I apologize. On Fri, Aug 17, 2012 at 5:50 PM, Nikita Popov nikita@gmail.com wrote: Could we please stop these pseudo-arguments?

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Rasmus Schultz
I have a login (mindplay) but I do not have permission to post or edit anything on the wiki... On Mon, Aug 20, 2012 at 8:01 PM, Will Fitch willfi...@php.net wrote: Please let this die until someone is serious enough to come up with an rfc. This has been nothing but counterproductive arguing.

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Rasmus Schultz
/321ad9b4b8c4e1713488 On Mon, Aug 20, 2012 at 10:10 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi, 2012/8/21 Rasmus Schultz ras...@mindplay.dk: I have a login (mindplay) but I do not have permission to post or edit anything on the wiki... I've created RFC for this https://wiki.php.net

Re: [PHP-DEV] Aspect Oriented Programming in PHP

2012-08-26 Thread Rasmus Schultz
On Thu, Aug 23, 2012 at 7:36 AM, Peter Nguyen pe...@likipe.se wrote: I know very little about AOP and don't pretend to know a lot, but how would we benefit from directly adding it into core instead of taking the approach FLOW3 did? as I see it, the problem with AOP in PHP is the same as

Re: [PHP-DEV] Aspect Oriented Programming in PHP

2012-08-26 Thread Rasmus Schultz
wrote: That's why I thnk the extension is superior to all other solutions, because it doesn't require code generation in userland. Also, it will be possible to backtrace to the declaration of the aspects. 2012/8/26 Rasmus Schultz ras...@mindplay.dk On Thu, Aug 23, 2012 at 7:36 AM, Peter

Re: [PHP-DEV] Support negative indexes for arrays and strings

2012-08-31 Thread Rasmus Schultz
Having thought about this for a while, I think this is a bad idea - here's why: $array = array(1001, 1002, 1003, 1004); $number = $array[-1]; // = 1004 $number[-1] = 1005; $number = $array[-1]; // = Obviously, the last statement must return 1005, since otherwise that

Re: [PHP-DEV] Support negative indexes for arrays and strings

2012-08-31 Thread Rasmus Schultz
Kovacs tyr...@gmail.com wrote: On Fri, Aug 31, 2012 at 3:14 PM, Rasmus Schultz ras...@mindplay.dk wrote: Having thought about this for a while, I think this is a bad idea - here's why: $array = array(1001, 1002, 1003, 1004); $number = $array[-1]; // = 1004 $number[-1] = 1005

[PHP-DEV] is GD being actively maintained?

2012-09-06 Thread Rasmus Schultz
I opened this bug report 2 years ago: https://bugs.php.net/bug.php?id=52756 Is GD still actively maintained? If it isn't, then perhaps it's time to start thinking about switching to a graphics library that is maintained? Perhaps something more modern with real drawing capabilities and a better

Re: [PHP-DEV] is GD being actively maintained?

2012-09-06 Thread Rasmus Schultz
Jannik, Thank you - this confirms I'm not crazy, or at least it's evidence to support that theory ;-) It may be OS specific - perhaps the Windows and OSX binaries are built against a different build (or configuration) of FreeType? Or it could be specific to 32 or 64 bit builds. I have never

Re: [PHP-DEV] is GD being actively maintained?

2012-09-07 Thread Rasmus Schultz
? On Fri, Sep 7, 2012 at 1:12 AM, Pierre Joye pierre@gmail.com wrote: On Fri, Sep 7, 2012 at 3:09 AM, Rasmus Schultz ras...@mindplay.dk wrote: Jannik, Thank you - this confirms I'm not crazy, or at least it's evidence to support that theory ;-) It may be OS specific - perhaps

[PHP-DEV] progressive buffer allocation

2012-09-10 Thread Rasmus Schultz
Interesting technique: http://ayende.com/blog/158721/rule-out-the-stupid-stuff-first-select-still-ainrsquo-t-broken I wonder if this is applicable to PHP in any way? Would stream buffers benefit from something like this? Perhaps not, I just thought it was interesting enough to share - it's not

[PHP-DEV] constructor hook

2012-09-18 Thread Rasmus Schultz
posting this for debate. Thanks, Rasmus Schultz

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Rasmus Schultz
Good point - I agree. Thanks for taking the time to think about this! On Tue, Sep 18, 2012 at 12:22 PM, jpauli jpa...@php.net wrote: On Tue, Sep 18, 2012 at 5:14 PM, Amaury Bouchard ama...@amaury.net wrote: Sounds to me like aspect-oriented programming, applied to object construction.

[PHP-DEV] Re: Arrays which have properties of sets

2012-10-06 Thread Rasmus Schultz
Since I was the one who started this discussion, I'd like to reply to some of these points. First off, let me say - as you pointed out, when the values are unique, they are best represented as keys... however, this of course applies only to value-types, which isn't the problem, and not why I

Re: [PHP-DEV] Re: Arrays which have properties of sets

2012-10-07 Thread Rasmus Schultz
Yeah, on that note - I've never understood what use this function is, as it reuses object IDs... it will return the same hash for two different objects during the same script execution - so it's unusable as far as getting unique keys for objects... and I don't know what else you could really use

Re: [PHP-DEV] Re: Arrays which have properties of sets

2012-10-07 Thread Rasmus Schultz
the manual states, The implementation in SplObjectStorage returns the same value as spl_object_hash() - so I don't know how this would really work any better than a custom implementation. perhaps safer would be to simply implement a collection-type that requires the classes of elements in the

Re: [PHP-DEV] Re: Arrays which have properties of sets

2012-10-07 Thread Rasmus Schultz
perhaps the worst case of misleading user comments to date... ;-) On Sun, Oct 7, 2012 at 7:51 PM, Sherif Ramadan theanomaly...@gmail.com wrote: On Sun, Oct 7, 2012 at 7:12 PM, Rasmus Schultz ras...@mindplay.dk wrote: the manual states, The implementation in SplObjectStorage returns the same value

Re: [PHP-DEV] [RFC] Propety Accessors v1.1

2012-10-09 Thread Rasmus Schultz
This looks great, and essentially has everything I had hoped for! My only remaining comment is on the read-only and write-only keywords... this seems really superfluous and strange to me - the syntax (using a hyphenated keyword) and the feature itself, is way off the grid as compared to other

Re: [PHP-DEV] [RFC] Propety Accessors v1.1

2012-10-10 Thread Rasmus Schultz
There's no way to stop the developer from doing that without read-only. Yes, there is - I don't even know why would write it that way - doesn't seem to make much sense. What you probably should be doing, is this: class A { private $seconds = 3600; public $hours { get() { return

Re: [PHP-DEV] [RFC] Propety Accessors v1.1

2012-10-10 Thread Rasmus Schultz
Just a couple of quick remarks. Clint wrote: I'm not even sure that automatic backing fields are even desired, I never felt the need to have them in C# and the only reason they were included is because they were a part of Dennis's original proposal. Automatic backing fields are indeed

[PHP-DEV] static analysis and early warning systems

2012-10-16 Thread Rasmus Schultz
Since there's a heavy debate on the list about strong typing right now, I just want to briefly share my point of view. PHP is not and won't be a strongly typed language. What it can be (and is on the way to be, with Clint's work) is a language that supports type-checking. Not the same as strongly

[PHP-DEV] Re: internals Digest 20 Oct 2012 09:49:39 -0000 Issue 2820

2012-10-20 Thread Rasmus Schultz
I second getting rid of write-onle - the only real case I can think of, is something like a password property on a user/account model-type, which gets encrypted and thus can't be read, and as Amaury pointed out, that should be a setPassword() method instead, perhaps even a separate

[PHP-DEV] Re: internals Digest 2 Dec 2012 00:53:48 -0000 Issue 2845

2012-12-01 Thread Rasmus Schultz
Isn't this need basically covered by accessors? https://wiki.php.net/rfc/propertygetsetsyntax-as-implemented - Rasmus On Sat, Dec 1, 2012 at 7:53 PM, internals-digest-h...@lists.php.net wrote: From: Sebastian Krebs krebs@gmail.com To: PHP internals list internals@lists.php.net Cc:

Re: [PHP-DEV] [RFC] Reflection annotations reader

2013-01-07 Thread Rasmus Schultz
agree and would like to work on a new RFC. - Rasmus Schultz

Re: [PHP-DEV] [RFC] Reflection annotations reader

2013-01-08 Thread Rasmus Schultz
I've started working on a new proposal, but I'm getting hung up on the syntax - if we can't use angle brackets anymore, what can we use? Virtually every symbol on a standard US keyword is an operator of some sort, does that mean those are all out of the question? e.g. thinking of concrete

Re: [PHP-DEV] [RFC] Reflection annotations reader

2013-01-08 Thread Rasmus Schultz
To summarize: A native implementation of PHP-DOC block parser for run-time purposes (annotation libraries) is already available in the Reflection API, and already goes as deep as it needs to - going beyond simply finding and extracting the docblocks would make little sense, as every annotation

Re: [PHP-DEV] [RFC] Reflection annotations reader

2013-01-09 Thread Rasmus Schultz
I'm going to address these question in the proposal I'm working on - once it's all in writing, I will post for debate. On Wed, Jan 9, 2013 at 2:57 PM, guilhermebla...@gmail.com guilhermebla...@gmail.com wrote: - Should we support nested annotations? - How [Foo()] will be different from new

[PHP-DEV] annotations, vision, goals

2013-01-12 Thread Rasmus Schultz
yours, and that's not necessarily something we should need to agree upon. Is it really the responsibility of the language to deliver high-level features that support patterns? Or should it deliver simpler features that support the implementation of those patterns? - Rasmus Schultz

Re: [PHP-DEV] annotations, vision, goals

2013-01-12 Thread Rasmus Schultz
at 5:29 PM, Rasmus Schultz ras...@mindplay.dkwrote: I hear a lot of interesting arguments in this big annotation discussion, and now there's the ongoing vision discussion, which got me thinking. It is true that there is broad community interest in annotations - part of the problem here

[PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-29 Thread Rasmus Schultz
. resources, but you could put your resources in an object and address that (very exotic) need. Bottom line, I'm not in favor of this idea - it just doesn't seem necessary or really even beneficial to me. - Rasmus Schultz

Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-31 Thread Rasmus Schultz
it here, and then we can discuss it... Anthony On Tue, Jan 29, 2013 at 8:03 AM, Rasmus Schultz ras...@mindplay.dk wrote: I just saw this RFC: https://wiki.php.net/rfc/foreach-non-scalar-keys By non-scalar, presumably we're talking about objects? In the numbers that e.g. resources

[PHP-DEV] short syntax for construction/initialization, named arguments and (future) annotations

2013-02-18 Thread Rasmus Schultz
This is a not a feature request, just a note on something that occurred to me. Since there is talk of native support for annotations again, it occurred to me that part of the problem that every userland implementation and proposed syntax deals with, along with native implementations in other

[PHP-DEV] rfc:trailing-comma-function-args

2013-02-22 Thread Rasmus Schultz
I've been thinking about this RCF for a while now: https://wiki.php.net/rfc/trailing-comma-function-args It just doesn't seem necessary - the only time I've ever found something like this to be necessary, is when a function takes closures or other very long arguments, some of which are

[PHP-DEV] static type-references

2013-03-14 Thread Rasmus Schultz
, what do you think about having a way to statically reference types and members? Thanks, Rasmus Schultz

Re: [PHP-DEV] static type-references

2013-03-14 Thread Rasmus Schultz
and ReflectionMethod. I could see this being really useful and powerful in view-engines, object/relational-mappers, data-mappers, validation-frameworks, etc. Nobody else thinks this is interesting? - Rasmus Schultz On Thu, Mar 14, 2013 at 12:42 PM, Etienne Kneuss col...@php.net wrote: Dear Rasmus

[PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-04 Thread Rasmus Schultz
relying on static helper-methods to modify their properties, and with no chance of any IDE support. Just putting that on the table... - Rasmus Schultz

Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-04 Thread Rasmus Schultz
Is it a really big feature if it's just syntactic sugar and internally stored as an array? say: struct Color { public $r = 1.0; public $g = 1.0; public $b = 1.0; } Stored internally this might be something like: array('__type'='Color', 'r'=1.0, 'g'=1.0, 'b'=1.0) Have you worked

Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-04 Thread Rasmus Schultz
You're right, struct isn't the right word - value is probably more accurate. value Color { public $r = 1.0; public $g = 1.0; public $b = 1.0; public function __construct($r, $g, $b) { $this-r = $r; $this-g = $g; $this-b = $b; } public function

Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-05 Thread Rasmus Schultz
April 2013 23:59, Rasmus Schultz ras...@mindplay.dk wrote: You're right, struct isn't the right word - value is probably more accurate. Actually structs in C# can have methods. They are exactly classes with value type semantics (i.e. pass-by-value, like arrays in PHP). I think struct would

Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-05 Thread Rasmus Schultz
in an internal array property somehow. Being able to juggle the types by accessing a reserved key might actually be a benefit? On Fri, Apr 5, 2013 at 8:50 AM, Rasmus Schultz ras...@mindplay.dk wrote: See the Structs Tutorial at msdn for a brief summary of structs in C# - http://msdn.microsoft.com/en

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-05 Thread Rasmus Schultz
On the other hand, I would just use an array. (without any magic like methods on structs, yes you would have to write plain functions and not use OOP like methods). Yeah, that's what people are doing right now - the problem with that, is you have the class-name referenced on every call, e.g.:

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] a couple of thoughts on the DateTime type debate

2013-04-05 Thread Rasmus Schultz
why not make struct almost like a class except that $this is a copy (on write) - modifying and returning $this would be a new instance of that struct/class. That would give you public/private/static/variables/methods/interfaces/..., but it would lead to another type. As said, I don't know

[PHP-DEV] vsprintf()

2013-04-24 Thread Rasmus Schultz
This is all kinds of wrong: http://3v4l.org/UZFME So the order in which the properties were defined is the magic that makes this work. Wow. WTF? Do I need to explain in detail why this is all kinds of effed up? - Rasmus Schultz

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Rasmus Schultz
Frankly, a magic method sounds like a much better solution than auto-magically converting objects to arrays. The problem with automatic conversion, is that the order of properties is an implementation detail - the vsprintf() example perfectly illustrates the problem: class User { public

[PHP-DEV] property de-referencing

2013-04-25 Thread Rasmus Schultz
the actual object-context. And the shortest possible syntax. What do you think? - Rasmus Schultz

Re: [PHP-DEV] property de-referencing

2013-04-25 Thread Rasmus Schultz
, and with support for static analysis. - Rasmus Schultz On Thu, Apr 25, 2013 at 9:22 AM, Nikita Popov nikita@gmail.com wrote: On Thu, Apr 25, 2013 at 2:47 PM, Rasmus Schultz ras...@mindplay.dkwrote: Okay, No one seemed extremely interested in my notes about static type-referenceshttp://marc.info/?t

Re: [PHP-DEV] property de-referencing

2013-04-29 Thread Rasmus Schultz
25.04.2013 um 14:47 schrieb Rasmus Schultz ras...@mindplay.dk: [...] What do you think? I'm not sure about the operator character but the general idea is a good one. Do you have a patch as a POC? cu, Lars

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
is evil about the thing I've described? On Tue, Apr 30, 2013 at 3:58 AM, Michael Wallner m...@php.net wrote: On 30 April 2013 01:45, Rasmus Schultz ras...@mindplay.dk wrote: The characters was an arbitrary choice, just for the sake of argument. I'm not a C programmer, so I don't have a patch

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
); // = PropertyReference(class: 'User', propertyName: 'name', object:User(...)) $foo = ^$user-name; var_dump($foo-getValue()); // = 'Rasmus' $foo-setValue('Bob'); var_dump($user-name); // = 'Bob' Is that easier to understand? - Rasmus Schultz On Tue, Apr 30, 2013 at 1:01 PM, Ferenc Kovacs tyr

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I don't think that's necessary - the point of being able to do this, is to apply meta-programming techniques, so in most situations, what matters is the ability to quickly create object/property-references... using them will usually happen inside some service component, e.g. a form-helper or

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
Any PHP dev who works with a mainstream framework does this daily, but the frameworks rely on strings for property-names. Take this example from the Symfony manual, for example: class Task { protected $task; protected $dueDate; public

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I suggested something similar earlier: http://marc.info/?t=13632784962r=1w=2 However, I withdrew that idea, because I came to the realization that, for practical applications, you usually need the object-context coupled with the member-reference to do anything really useful. A form-input

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I've already demonstrated and explained what's wrong with strings. Weird indirection is what we have in every mainstream framework right now, where properties can be referenced only as strings - I gave a real-world example of this, and demonstrated with a practical example how the proposed

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
On Tue, Apr 30, 2013 at 7:34 PM, Adam Harvey ahar...@php.net wrote: I would caution against generalising use cases. Personally, ::class is something I can use multiple times a day. This I'm not so sure about. Your use case is not my use case, and vice versa. :) What is your use-case then?

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
@gmail.comwrote: 2013/5/1 Rasmus Schultz ras...@mindplay.dk Any PHP dev who works with a mainstream framework does this daily, but the frameworks rely on strings for property-names. Take this example from the Symfony manual, for example: class Task

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
- bitwise operators are not one of the most commonly used features in high-level languages. If the asterisk (or some other character) offers and easier implementation path, whatever. On Tue, Apr 30, 2013 at 7:55 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 04/30/2013 03:24 PM, Rasmus Schultz

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
This won't work, because Task::$task is a protected property It will work for code that's properly documented with @property annotations. On Wed, May 1, 2013 at 7:05 AM, Jannik Zschiesche he...@apfelbox.netwrote: Hi, Lazare Inepologlou linep...@gmail.com Mittwoch, 1. Mai 2013 10:55

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
Note that the dynamic User::$name property in this example is properly documented and will reflect in an IDE. On Tue, Apr 30, 2013 at 8:43 PM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 04/30/2013 05:17 PM, Rasmus Schultz wrote: If the asterisk (or some other character) offers and easier

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
, Peter Lind peter.e.l...@gmail.com wrote: On 1 May 2013 14:35, Rasmus Schultz ras...@mindplay.dk wrote: This is a fringe feature, as evidenced by the fact that you are having a hard time convincing people that it is needed As with anything that isn't already established and well-known

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
at 10:24 AM, Etienne Kneuss col...@php.net wrote: On Wed, May 1, 2013 at 2:35 PM, Rasmus Schultz ras...@mindplay.dk wrote: This is a fringe feature, as evidenced by the fact that you are having a hard time convincing people that it is needed As with anything that isn't already

RE: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
Hi Mike, Missed your e-mail because it went to the list only. What you're demonstrating here is functionally equivalent to the simple example I provided. (The example was intended to show how this feature works, not necessarily how you would use it in practice.) The key difference, is that a

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
in Drupal from now on, where everything is a string or an array or a stdClass - at least then there's consistently no checkable literals or IDE support for anything. Awesome. On Wed, May 1, 2013 at 5:12 PM, Etienne Kneuss col...@php.net wrote: On Wed, May 1, 2013 at 7:13 PM, Rasmus Schultz ras

Re: [PHP-DEV] property de-referencing

2013-05-01 Thread Rasmus Schultz
extend. -Ursprüngliche Nachricht- Von: ekne...@gmail.com [mailto:ekne...@gmail.com] Im Auftrag von Etienne Kneuss Gesendet: Mittwoch, 1. Mai 2013 22:12 An: Rasmus Schultz Cc: Rasmus Lerdorf; Stas Malyshev; PHP internals Betreff: Re: [PHP-DEV] property de-referencing On Wed, May 1, 2013

Re: [PHP-DEV] property de-referencing

2013-05-02 Thread Rasmus Schultz
of view. Imagine an abstract syntax tree. They would look alike because ^$user-name; is only a shorthand for new PropertyReference($user, 'name'); ** ** Cheers, Robert ** ** ** ** ** ** *Von:* Rasmus Schultz [mailto:ras...@mindplay.dk] *Gesendet:* Donnerstag, 2. Mai 2013 01:51

Re: [PHP-DEV] property de-referencing

2013-05-02 Thread Rasmus Schultz
...@gmail.comwrote: 2013/5/1 Rasmus Schultz ras...@mindplay.dk One could write a PropertyReference class right now with literally the only difference being the lack of a builtin operator (ie new PropertyReference($obj, 'prop') versus ^$obj-prop): the fact that nobody seems to have done

Re: [PHP-DEV] property de-referencing

2013-05-02 Thread Rasmus Schultz
quit or think you're all done? :-) On Thu, May 2, 2013 at 10:33 AM, Rasmus Schultz ras...@mindplay.dk wrote: authors[0].personalDetails[firstName] which translates to -getAuthors()[0]-getPersonalDetails()['firstName'] It's indirection via strings. This particular example isn't great

Re: [PHP-DEV] property de-referencing

2013-05-02 Thread Rasmus Schultz
a shorthand for “new PropertyReference($user, 'name');”? Von: Rasmus Schultz [mailto:ras...@mindplay.dk] Gesendet: Donnerstag, 2. Mai 2013 14:14 An: Robert Stoll Cc: Etienne Kneuss; Rasmus Lerdorf; Stas Malyshev; PHP internals Betreff: Re: [PHP-DEV] property de-referencing As you described, IDEs

Re: [PHP-DEV] property de-referencing

2013-05-03 Thread Rasmus Schultz
, 2013 at 4:24 AM, Lazare Inepologlou linep...@gmail.comwrote: 2013/5/2 Bernhard Schussek bschus...@gmail.com 2013/5/1 Rasmus Schultz ras...@mindplay.dk One could write a PropertyReference class right now with literally the only difference being the lack of a builtin operator (ie new

Re: [PHP-DEV] property de-referencing

2013-05-06 Thread Rasmus Schultz
for instance, where property references don't exist too. Regards, Seva On Tue, Apr 30, 2013 at 6:24 PM, Rasmus Schultz ras...@mindplay.dkwrote: Any PHP dev who works with a mainstream framework does this daily, but the frameworks rely on strings for property-names. Take this example from

Re: [PHP-DEV] property de-referencing

2013-05-06 Thread Rasmus Schultz
distinguishable string format could represent it with no extra handling. On Mon, May 6, 2013 at 12:44 PM, Rasmus Schultz ras...@mindplay.dkwrote: Seva, I understand that you can reference properties more consistently using {fullClassName}::{fieldName} notation, but it's still a string

Re: [PHP-DEV] property de-referencing

2013-05-07 Thread Rasmus Schultz
, 2013 at 9:41 AM, Seva Lapsha seva.lap...@gmail.com wrote: Good developers research and find *best* ways to use the available tools before inventing new ones. On Mon, May 6, 2013 at 2:46 PM, Rasmus Schultz ras...@mindplay.dk wrote: Well, I don't disagree as such - there's any number

Re: [PHP-DEV] property de-referencing

2013-05-07 Thread Rasmus Schultz
: Maybe PHP is just not for you. There are other languages in the sea :) On Tue, May 7, 2013 at 10:32 AM, Rasmus Schultz ras...@mindplay.dkwrote: And what do good developers do when the best ways have long since been identified - and the limitations of the language prevents them from

[PHP-DEV] exceptions during __toString()

2013-05-09 Thread Rasmus Schultz
I just ran into this issue again: http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring Instead of throwing some nonsense you're not allowed to throw from here error-message, how about actually unwinding the stack and passing the exception to the global

Re: [PHP-DEV] exceptions during __toString()

2013-05-09 Thread Rasmus Schultz
calls made to __toString() internally. Wouldn't that at least suck less? :-) On Thu, May 9, 2013 at 6:50 PM, Etienne Kneuss col...@php.net wrote: On Fri, May 10, 2013 at 12:00 AM, Rasmus Schultz m...@rasmus-schultz.comwrote: I just ran into this issue again: http://stackoverflow.com

[PHP-DEV] Re: internals Digest 6 Jun 2013 16:02:57 -0000 Issue 3007

2013-06-06 Thread Rasmus Schultz
there is one framework that does not have some variety of accessors, and I have not personally written a library or application in the past 5 or 6 years without adding boilerplate practically identical to the above... - Rasmus Schultz -- Forwarded message -- From: Galen Wright

[PHP-DEV] crc32() and ip2long() return values

2013-08-27 Thread Rasmus Schultz
. These functions need to work **for php developers**. - Rasmus Schultz

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload

2011-08-14 Thread Rasmus Schultz
/dispatcher might need to autoload action-filters, etc. Just a thought :-) / Rasmus Schultz

Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload

2011-08-15 Thread Rasmus Schultz
a thought - just throwing it out there for discussion, I'm not submitting a complete RFC at this point :-) / Rasmus Schultz On Sun, Aug 14, 2011 at 6:44 PM, Ferenc Kovacs tyr...@gmail.com wrote: On Mon, Aug 15, 2011 at 12:11 AM, Rasmus Schultz ras...@mindplay.dk wrote: Instead of trying to figure

[PHP-DEV] some notes about traits

2011-11-11 Thread Rasmus Schultz
It seems to me, there's a couple of things related to traits that were missed in this implementation. Take the following example: ?php header('Content-type: text/plain'); class Cart { public static $instance; # public function addItem(CartBehavior $item, $amount=1) // = script terminates

Re: [PHP-DEV] some notes about traits

2011-11-15 Thread Rasmus Schultz
will help us all better to understand what the underlying issues/conceptual problems are we need to tackle, either by improving the current implementation and/or documentation. On 11 Nov 2011, at 17:00, Rasmus Schultz wrote: class Cart { public static $instance; # public function addItem

Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Rasmus Schultz
who can hook me up with a login, so I can contribute to the documentation? Here's a better example of something useful that actually works: Assuming your example is OK, you could edit the doc and submit it as a patch at https://edit.php.net.

[PHP-DEV] Re: Patch: getters/setters syntax Implementation

2011-12-05 Thread Rasmus Schultz
2011/12/4 Clint M Priest cpri...@zerocue.com: Updated patch w/o white-space: http://www.clintpriest.com/patches/accessors_v1.patch In the end it is a relatively simple patch. The new syntax effectively creates internal functions on the object and the system looks for those functions and calls

Re: [PHP-DEV] Re: Patch: getters/setters syntax Implementation

2011-12-06 Thread Rasmus Schultz
On Tue, Dec 6, 2011 at 3:45 AM, Christian Kaps christian.k...@mohiva.comwrote: Hi, I also find this syntax confusing and I think it has a huge WTF factor. Some thoughts about the syntax: - At the first glance, it isn't clear which visibility the getter or setter has - The extra

Re: [PHP-DEV] Patch: getters/setters syntax Implementation

2011-12-07 Thread Rasmus Schultz
identifying it as an accessor I'm saying be creative - don't just implement something halfway for the sake of getting it done. On Dec 7, 2011, at 12:50 PM, Rasmus Schultz wrote: if we're attempting to get around __set/get, let's not replace them with more method implementations I

[PHP-DEV] Phalanger

2011-12-08 Thread Rasmus Schultz
understand the licensing may be an issue. It may be the argument that outweighs everything else, but I'm curious to hear what else would keep you from moving to Phalanger? Thanks! - Rasmus Schultz

Re: [PHP-DEV] Phalanger

2011-12-09 Thread Rasmus Schultz
You want to compare Mono performance to .NET performance - I'm sorry, but I don't see how that's even relevant? Your benchmark would be relevant if I was proposing you write a PHP interpreter and run that on Mono. What I'm proposing (and what Phalanger does) is to compile PHP code to CLR

[PHP-DEV] APC caching identical files multiple times

2011-12-12 Thread Rasmus Schultz
Hello Folks, We're hosting an increasing number of Drupal (ick) sites on our servers, and while going over the diagnostic screen for APC, we noticed that identical files are being cached multiple times. For example, user.module is cached 3 times for 3 sites. I've seen other people asking this

[PHP-DEV] ReflectionFile missing

2012-01-29 Thread Rasmus Schultz
an annotation. Neither approach is very elegant. This is addressed by the language, by allowing you to import classes and interfaces - annotation libraries could discover imported annotation types this way, but that aspect of the source code is not exposed via Reflection. Any thoughts? - Rasmus

Re: [PHP-DEV] ReflectionFile missing

2012-01-30 Thread Rasmus Schultz
aspects of PHP that need attention... 2012/1/29 Johannes Schlüter johan...@schlueters.de Hi, On Sun, 2012-01-29 at 18:51 -0500, Rasmus Schultz wrote: I realized the other day that ReflectionFile is missing from the Reflection API. As is ReflectionNamespace and some others one might think

Re: [PHP-DEV] ReflectionFile missing

2012-01-30 Thread Rasmus Schultz
to implement this feature in different ways... 2012/1/30 Johannes Schlüter johan...@schlueters.de On Mon, 2012-01-30 at 09:33 -0500, Rasmus Schultz wrote: From my point of view, the concept of a file has become semantically more important, and increasingly relevant to Reflection

  1   2   3   >