Re: [PHP-DEV] generating code from AST

2017-03-08 Thread Nikita Nefedov
> On 8 Mar 2017, at 08:49, Sebastian Bergmann wrote: > > Am 07.03.2017 um 11:33 schrieb Derick Rethans: >> Because installing an extension is too hard? > > No. To ensure that userland functionality that is based on compiler > internals (token stream, abstract syntax tree,

Re: [PHP-DEV] [RFC][Discuss] Arrow Functions

2017-01-31 Thread Nikita Nefedov
On Mon, 30 Jan 2017 20:55:07 +0300, Levi Morrison wrote: Bob Weinand and I are happy to announce that the [Arrow Functions][1] RFC is moving into the public discussion phase. We have been collaborating on this RFC for many months now and finally have a proposal we are happy to

Re: [PHP-DEV] Not autoloading functions

2017-01-27 Thread Nikita Nefedov
On Fri, 20 Jan 2017 10:04:44 +0300, Rasmus Schultz wrote: Just a quick thought. Since the autoloading functions proposal is stalled, how about allowing for import of static functions instead? use function Foo::bar; bar(); // calls Foo::bar() There are two

Re: [PHP-DEV] Class Constant Finalization

2017-01-24 Thread Nikita Nefedov
> On 25 Jan 2017, at 09:48, Scott Arciszewski wrote: > > All, > > Given that we can now declare a class constant as public, protected, or > private, can we also declare them final in 7.2? > > https://3v4l.org/rJG0V > > Ideally, this code would error on line 18 rather

Re: [PHP-DEV] Change in type-hint representation

2017-01-11 Thread Nikita Nefedov
> On 11 Jan 2017, at 19:37, Dmitry Stogov wrote: > > The patch was updated according to feedback: added comments, better names and > encapsulation, less magic, better code reuse, keep a free bit in zend_type > for future extension. >

Re: [PHP-DEV] Change in type-hint representation

2017-01-11 Thread Nikita Nefedov
On Wed, 11 Jan 2017 16:51:22 +0300, Michał Brzuchalski <mic...@brzuchalski.com> wrote: 2017-01-11 14:35 GMT+01:00 Nikita Nefedov <inefe...@gmail.com>: -- snip -- [ ] xxy0 - for IS_OBJECT type hint where the ``s are a (zend_strin

Re: [PHP-DEV] Change in type-hint representation

2017-01-11 Thread Nikita Nefedov
On Wed, 11 Jan 2017 15:07:39 +0300, Dmitry Stogov wrote: Hi, I propose to introduce a unified type representation (zend_type). Now it's going to be used for typing of arguments and return values. Later we should use it for properties and other things.

Re: [PHP-DEV] Re: number_format() = "-0.00"

2016-11-25 Thread Nikita Nefedov
> On 25 Nov 2016, at 21:07, David Rodrigues wrote: > > As reference, I'll put here what some languages does on this case: > > Java:-0.00 (http://ideone.com/NOxen1) > Python: -0.00 (http://ideone.com/llxGHA) > Ruby:-0.00 (http://ideone.com/j3KgMd) > C++14:

Re: [PHP-DEV] number_format() = "-0.00"

2016-11-25 Thread Nikita Nefedov
On Fri, 25 Nov 2016 11:10:47 +0300, Rasmus Lerdorf wrote: On Thu, Nov 24, 2016 at 11:54 PM, Craig Duncan wrote: I've submit a PR (https://github.com/php/php-src/pull/2220) to fix a bug ( https://bugs.php.net/bug.php?id=73581). Kalle suggested I

Re: [PHP-DEV] DateTime microseconds discussion

2016-11-08 Thread Nikita Nefedov
Hey Arjen, On 8 November 2016 at 09:32, Arjen Schol wrote: There is no easy way to set microseconds to 0, you have to call setTime There actually is an easy way, you can pass microseconds absolute value in the constructor as well, it would like: `new DateTime("5 minutes ago,

Re: [PHP-DEV] OpenSSL - New Defaults

2016-11-07 Thread Nikita Nefedov
> On 7 Nov 2016, at 03:35, Scott Arciszewski wrote: > >> On Sun, Nov 6, 2016 at 2:19 PM, Jakub Zelenka wrote: >> Hi, >> >> On Thu, Nov 3, 2016 at 4:11 PM, Scott Arciszewski >> wrote: >>> >>> Hi, >>> >>> Can we change

[PHP-DEV] Statically verifiable callables

2016-06-21 Thread Nikita Nefedov
Morning internals, I would like to gather some reactions on the proposal to add a 'statically verifiable callable as a closure language construct'. That would be functionally similar to the recently added Closure::fromCallable() with the exception being statically verified by IDEs or

[PHP-DEV] Re: [RFC] [Vote] Callable types (now: Callable prototypes)

2016-06-06 Thread Nikita Nefedov
Evening internals, The vote for Callable prototypes has been declined with 18 votes in favor and 19 against adding the feature. Thanks everyone for participating, we will work on problems raised in the discussion and see if it meets people's expectations in 7.2 -- PHP Internals - PHP

Re: [PHP-DEV] can't reflection on DateTime properties?

2016-06-04 Thread Nikita Nefedov
On Sat, 04 Jun 2016 22:36:19 +0300, Rasmus Schultz wrote: I wrote a library that can serialize/unserialize PHP object graphs to JSON data. Somebody reported it doesn't work on the DateTime class. Does this deliberately not work? $date = new DateTime();

Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-24 Thread Nikita Nefedov
On Tue, 24 May 2016 02:24:12 +0300, Dan Ackroyd <dan...@basereality.com> wrote: Hi Nikita, On 23 May 2016 at 15:27, Nikita Nefedov <inefe...@gmail.com> wrote: With this message I'd like to go to vote with the Callable prototypes RFC targeted at 7.1: https://wiki.php.net/rfc/ca

Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-24 Thread Nikita Nefedov
On Mon, 23 May 2016 22:59:10 +0300, Markus Fischer <mar...@fischer.name> wrote: Hello Nikita, On 23.05.16 21:27, Nikita Nefedov wrote: When you pass an `int` to a `string` type parameter in weak mode it's being coerced to the needed type (not just directly passed). This is quite c

Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-23 Thread Nikita Nefedov
On Mon, 23 May 2016 22:52:18 +0300, Levi Morrison <le...@php.net> wrote: On Mon, May 23, 2016 at 1:19 PM, Nikita Nefedov <inefe...@gmail.com> wrote: On 23 May 2016, at 19:31, Levi Morrison <le...@php.net> wrote: A quick question before I vote: do callable prototypes

Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-23 Thread Nikita Nefedov
icular reason to this seemingly arbitrary restriction? Bob Am 23.05.2016 um 16:27 schrieb Nikita Nefedov <inefe...@gmail.com>: Evening internals, With this message I'd like to go to vote with the Callable prototypes RFC targeted at 7.1: https://wiki.php.net/rfc/callable-types W

Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-23 Thread Nikita Nefedov
> On 23 May 2016, at 19:31, Levi Morrison <le...@php.net> wrote: > >> On Mon, May 23, 2016 at 8:27 AM, Nikita Nefedov <inefe...@gmail.com> wrote: >> Evening internals, >> >> With this message I'd like to go to vote >> with the Callable prototypes

[PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes)

2016-05-23 Thread Nikita Nefedov
Evening internals, With this message I'd like to go to vote with the Callable prototypes RFC targeted at 7.1: https://wiki.php.net/rfc/callable-types We've renamed it (previously was "Callable types") as RFC names often dictate how users will call the feature and I want it to be more

Re: [PHP-DEV] [RFC][VOTE] Closure from callable

2016-05-16 Thread Nikita Nefedov
On Mon, 16 May 2016 03:56:38 +0300, Sara Golemon <poll...@php.net> wrote: On Sun, May 15, 2016 at 11:20 AM, Nikita Nefedov <inefe...@gmail.com> wrote: why would you need to support a $this->fieldName case though? Because to not support it would be to deliberately design

Re: [PHP-DEV] [RFC][VOTE] Closure from callable

2016-05-15 Thread Nikita Nefedov
> On 15 May 2016, at 20:29, Dan Ackroyd wrote: > > Hello, > > I've opened the voting for the Closure from callable RFC - > https://wiki.php.net/rfc/closurefromcallable > > Just to note, some people I've spoken to have expressed a desire to > have a more powerful syntax

Re: [PHP-DEV][RFC] Callable Types

2016-04-26 Thread Nikita Nefedov
Bringing this thread to the main one On Sun, 24 Apr 2016 06:27:39 +0300, Mathieu Rochette wrote: I've seen someone mentioning variadics so I made a few small tests, I think those two should work (they currently don't): https://3v4l.org/eZgR9/rfc#rfc-callable_typehint

Re: [PHP-DEV][RFC] Callable Types

2016-04-26 Thread Nikita Nefedov
On Sat, 23 Apr 2016 20:44:27 +0300, Jesse Schalken wrote: I see. So it's the combination of not erroring when more parameters are passed than a function accepts, and >permitting methods to add extra optional parameters that is wrong. So without the former being

Re: [PHP-DEV][RFC] Callable Types

2016-04-23 Thread Nikita Nefedov
On Sat, 23 Apr 2016 14:18:56 +0300, Dan Ackroyd wrote: On 22 April 2016 at 05:12, Marcio Almada wrote: Hello everyone, We just completed the draft for the "Callable Types" RFC. There seems to be one thing missing from the RFC; please could

Re: [PHP-DEV][RFC] Callable Types

2016-04-23 Thread Nikita Nefedov
On Sat, 23 Apr 2016 10:46:38 +0300, Jesse Schalken wrote: This is great. The gaps in PHP's type annotations are slowly being filled. :) Are the rules for compatibility between callables the same rules for compatibility between methods in classes/interfaces? Because

Re: [PHP-DEV][RFC] Callable Types

2016-04-22 Thread Nikita Nefedov
on about the RFC and work on possible improvements! Thanks Nikita Nefedov Márcio Almada Hello internals, We're still having a hard time finding a proper format for error message about incompatible callable being passed. Right now it looks like this: Uncaught TypeError: Argument 3 passed

Re: [PHP-DEV] Object getter method optimization

2016-03-20 Thread Nikita Nefedov
On Sat, 19 Mar 2016 23:40:09 +0300, Andrea Faulds wrote: Hi Lin, Lin Yo-An wrote: Since the original approach doesn't work, here comes another new idea: When executing method call on an object, if we found the method body are just 2 op codes (FETCH_OBJ_R and RETURN), we then

Re: [PHP-DEV] Re: [RFC] Callable constructors

2016-02-26 Thread Nikita Nefedov
On Fri, 26 Feb 2016 14:28:19 +0300, Andrea Faulds wrote: Hi Rowan, Rowan Collins wrote: On 25/02/2016 17:40, Andrea Faulds wrote: Snipped for brevity, but I agree with your sentiment here. Making __construct more magic seems like an imperfect solution to this. I'm not sure

Re: [PHP-DEV] In a destructor, how to detect if an exception is currently in flight?

2015-10-28 Thread Nikita Nefedov
Hi Erik, On Wed, 28 Oct 2015 16:28:59 +0300, Erik van Velzen wrote: Thanks for your input. I did not try-catch because it doesn't really work, you either duplicate rollback code or get excessive nesting. Real code will obviously be more complicated than the examples. Also in

Re: [PHP-DEV] Re: [PHP Wiki] Your DokuWiki password

2015-10-02 Thread Nikita Nefedov
On Fri, 02 Oct 2015 12:58:30 +0300, Andréas H. wrote: My login is : screamz I would like to edit my profile, first at all. Then Sometimes I would like to edit french translation that are not true, (if I can ?) Thanks Best regards 2015-10-02 11:54 GMT+02:00

Re: [PHP-DEV] Arrow function expressions in PHP

2015-10-01 Thread Nikita Nefedov
On Thu, 01 Oct 2015 13:48:52 +0300, Rowan Collins wrote: Levi Morrison wrote on 01/10/2015 04:06: I'm going to ask everyone to stop saying that auto-closing is bad unless they also provide a demonstration of why it was bad. Please see my e-mail from last night, or

Re: [PHP-DEV] Arrow function expressions in PHP

2015-10-01 Thread Nikita Nefedov
On Thu, 01 Oct 2015 15:33:51 +0300, Rowan Collins wrote: That's not how Rasmus expressed it [http://marc.info/?l=php-internals=144107616411299=2]: > I made a very deliberate decision In the very first implementation of PHP to avoid scope side-effects like this.

Re: AW: [PHP-DEV] [RFC] [Discussion] Short Closures

2015-09-07 Thread Nikita Nefedov
On Mon, 07 Sep 2015 11:46:18 +0300, Robert Stoll wrote: Hi Bob -Ursprüngliche Nachricht- Von: Bob Weinand [mailto:bobw...@hotmail.com] Gesendet: Montag, 31. August 2015 21:29 An: PHP Internals Betreff: [PHP-DEV] [RFC] [Discussion] Short Closures I had this RFC in

[PHP-DEV] Requesting RFC karma

2015-09-03 Thread Nikita Nefedov
Hey everyone, I'm asking for some RFC karma for wiki account nikita2206 in preparation of callable typehints RFC [0] with Marcio, and some other RFCs in the future. Thanks in advance \O/ [0] https://wiki.php.net/rfc/callable-types -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] [RFC] [Discussion] Short Closures

2015-08-31 Thread Nikita Nefedov
On Tue, 01 Sep 2015 00:05:35 +0300, Stanislav Malyshev wrote: Hi! I had this RFC in draft since some time, but delayed it due to all the ongoing PHP 7 discussions. Also we have no master branch to merge features in until 5.4 EOL. Thus I'm reviving this now. Time for

Re: [PHP-DEV] [RFC] [Discuss] Random Functions Throwing Exceptions in PHP 7.0.0

2015-08-23 Thread Nikita Nefedov
On 23 Aug 2015, at 18:37, Thomas Bley ma...@thomasbley.de wrote: consider this code: declare(strict_types=0); ini_set('display_errors', '1'); function get_random_int(): int { return false; } echo get_random_int(); and then use strict_types=1 So you're implying that in case of

Re: [PHP-DEV] ::class wrong case

2015-05-25 Thread Nikita Nefedov
On Mon, 25 May 2015 20:47:32 +0300, Marc Bennewitz dev@mabe.berlin wrote: Hi, I have noted that detecting a class name using ::class it will return the called case instead of the original case. see http://3v4l.org/97K36 That's annoying as I like to check the right class case on autoload to

Re: [PHP-DEV] [RFC][Accepted] Scalar Type Declarations V0.5

2015-03-18 Thread Nikita Nefedov
On 18 Mar 2015 15:52, Pavel Kouřil pajou...@gmail.com wrote: Hello, I made that conclusion because in the first example, the library kinda forces strict mode rules on the caller, even if he doesn't want to use strict mode - this makes the interoperability of the two modes problematic. This

Re: [PHP-DEV] [RFC][Accepted] Scalar Type Declarations V0.5

2015-03-18 Thread Nikita Nefedov
On 18 Mar 2015 14:32, Pavel Kouřil pajou...@gmail.com wrote: On Wednesday, March 18, 2015, Patrick ALLAERT patrickalla...@php.net wrote: Le mer. 18 mars 2015 à 10:56, Pavel Kouřil pajou...@gmail.com a écrit : Hello, how will these examples work btw? // a.php ?php

Re: [PHP-DEV] About declare(strict_types = 1)

2015-03-16 Thread Nikita Nefedov
On Mon, 16 Mar 2015 14:33:00 +0300, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Derick, On Mon, Mar 16, 2015 at 8:18 PM, Derick Rethans der...@php.net wrote: To be frank, I don't think I don't like this is a terribly good reason to vote against (or for something). What is important is how

Re: [PHP-DEV] About declare(strict_types = 1)

2015-03-16 Thread Nikita Nefedov
On Mon, 16 Mar 2015 14:50:16 +0300, Yasuo Ohgaki yohg...@ohgaki.net wrote: I already showed real world example how this could be fail. If we need this kind of behavior. I would suggest to have type affinity like SQLite for $_GET/$_POST/$_COOKIE. https://www.sqlite.org/datatype3.html This

Re: [PHP-DEV] [RFC][VOTE] In Operator

2015-03-16 Thread Nikita Nefedov
On Mon, 16 Mar 2015 12:09:42 +0300, Lester Caine les...@lsces.co.uk wrote: On 16/03/15 08:55, Marco Pivetta wrote: PEAR surely isn't where you'd look for new code nowadays: it's a legacy repository. Give me an alternative? I've had to update my own cope of PEAR so it's clean E_STRICT, but

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-20 Thread Nikita Nefedov
On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston tonymars...@hotmail.com wrote: I disagree. Exceptions were originally invented to solve the semipredicate problem which only exists with procedural functions, not object methods. Many OO purists would like exceptions to be thrown

Re: [PHP-DEV] Digit separators for numeric literals

2015-02-19 Thread Nikita Nefedov
2015-02-19 6:44 GMT+04:00 Rasmus Lerdorf ras...@lerdorf.com: I think it will be difficult to find a separator character that doesn't make a mess of the grammar. my_func(1,999,999) obviously doesn't work my_func(1'999'999) as per C++14 clashes with our single-quoted strings

Re: [PHP-DEV] [RFC] Exceptions in the engine

2015-02-18 Thread Nikita Nefedov
On 18 Feb 2015 13:53, Tony Marston tonymars...@hotmail.com wrote: Could it be restricted to the current scope? In your example the call to fopen() exists in the load_data() function and is not in a try ... catch block within *that* function, so the fact that the call to load_data() is within a

Re: [PHP-DEV] [VOTE] Scalar Type Hints

2015-02-13 Thread Nikita Nefedov
On 13 Feb 2015 19:37, Benjamin Eberlei kont...@beberlei.de wrote: Wait i almost forgot, it *does* have an effect on me, especially around callback handling: https://gist.github.com/schmittjoh/778e044deacc6f1fe516 Essentially callbacks are evaluated in the mode they are called in, not in

Re: [PHP-DEV][RFC][VOTE] Group Use Declarations

2015-02-13 Thread Nikita Nefedov
On 13 Feb 2015 22:31, Lester Caine les...@lsces.co.uk wrote: Can't we restore the simple way of working in PHP7 where it does not need to wrap around other things quite so closely? Hi Lester, This way if doing things on php didn't go anywhere, people just stopped using it because they saw

Re: [PHP-DEV] [VOTE] Scalar Type Hints

2015-02-12 Thread Nikita Nefedov
Hi, 2015-02-12 18:31 GMT+04:00 Andrea Faulds a...@ajf.me: Hi Pavel, On 12 Feb 2015, at 13:48, Pavel Kouřil pajou...@gmail.com wrote: C# does have dynamic typing. No it doesn’t, it’s a statically-typed language. I don’t understand why you say it has dynamic typing - there is some

Re: [PHP-DEV] [VOTE] Scalar Type Hints

2015-02-11 Thread Nikita Nefedov
On 11 Feb 2015 09:38, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/10/2015 07:57 PM, Xinchen Hui wrote: am I wrong?! seems I am wrong with this, it's a false alarm... it can restore automatically. Yeah, declare() doesn't span files so that isn't a problem. My worry is still the lack

Re: [PHP-DEV] Allow arbitrary expressions when using instanceof operator

2014-11-06 Thread Nikita Nefedov
On Thu, 06 Nov 2014 13:01:52 +0400, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! What I want to implement is the ability to allow arbitrary expressions on the second operand, so instead of having to write something like this: I'm afraid there's a problem with this. Arbitrary

Re: [PHP-DEV] RFC: Return Types Update

2014-10-16 Thread Nikita Nefedov
On Thu, 16 Oct 2014 18:39:06 +0400, Davey Shafik da...@php.net wrote: I very much like this — though I would say it was dependent on the nullable types RFC (like splat and variadics were codependent). While I would like to see the introduction of a void type, I understand and respect the

Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures

2014-08-03 Thread Nikita Nefedov
Hey Andrea, I really love function referencing RFC, this is something I miss in PHP and would I have a voting right I'd would +1 even in this state of it. But I dislike a bit the fact that we start to use Closure for everything, I really wish we had a dedicated type for functions (read

Re: [PHP-DEV] [RFC] Escaping RFC for PHP Core - Updates?

2013-09-07 Thread Nikita Nefedov
On Sat, 07 Sep 2013 20:08:45 +0400, Michael John Burgess mich...@mjburgess.co.uk wrote: On 07/09/2013 15:41, Levi Morrison wrote: It looks nicer than Escaper::escapeJs(), Escaper::escapeHtml(), etc. Any comments? Please, don't go down this route. You do not want one class to escape all

Re: [PHP-DEV] RFC: Protocol Type Hinting

2013-06-26 Thread Nikita Nefedov
Hi, On Wed, 26 Jun 2013 02:57:46 +0400, Stas Malyshev smalys...@sugarcrm.com wrote: That means all you really need is to call method named get, regardless of what it actually does. Usually the code doesn't work this way - you expect something to actually happen if you call get(), something

Re: [PHP-DEV] RFC: Protocol Type Hinting

2013-06-25 Thread Nikita Nefedov
On Tue, 25 Jun 2013 19:57:15 +0400, Anthony Ferrara ircmax...@gmail.com wrote: Hey all, I want to throw out this draft RFC to get the concept floating around and get feedback early. https://wiki.php.net/rfc/protocol_type_hinting There are still open questions, and a more complete (and

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

2013-04-04 Thread Nikita Nefedov
On Thu, 04 Apr 2013 19:13:54 +0400, Rasmus Schultz ras...@mindplay.dk wrote: I've been pondering this issue for a while now, and I keep reaching the same conclusion, so I'm going to just briefly share what I think. In my opinion, the real issue is not poor design of the DateTime class - it

Re: [PHP-DEV] DateTimeImmutable

2013-03-28 Thread Nikita Nefedov
On Thu, 28 Mar 2013 13:04:44 +0400, Lars Strojny l...@strojny.net wrote: Hi Derick, Am 27.03.2013 um 21:53 schrieb Derick Rethans der...@php.net: On Tue, 26 Mar 2013, Michael Wallner wrote: providing DateTimeImmutable as a sibling to DateTime. That's fine with me, but I am not having the

Re: [PHP-DEV] Could we kill call_user_func?

2013-03-18 Thread Nikita Nefedov
On Mon, 18 Mar 2013 19:03:41 +0400, Julien Pauli jpa...@php.net wrote: On Mon, Mar 18, 2013 at 3:33 PM, Anthony Ferrara ircmax...@gmail.comwrote: Angel, On 18/03/13 14:04, Julien Pauli wrote: Also, AFAIR, call_user_func() doesn't work with functions using references in args.

Re: [PHP-DEV] feature request : easy shared memory

2013-03-14 Thread Nikita Nefedov
On Thu, 14 Mar 2013 07:05:03 -, rene7705 rene7...@gmail.com wrote: Hi. I'd like to build a replacement for SQL (yes, talk about an ambitious project! ;), because the constant transferal of data in and out of SQL from Javascript (where everything might as well be object-oriented and

[PHP-DEV] Should sessions override user sent headers?

2013-03-06 Thread Nikita Nefedov
Hi, so I stumbled upon this bug report: https://bugs.php.net/bug.php?id=64357 It's fairly easily fixable, but I don't know if it's even a bug... The problem here: sessions always send Expire header (except for private_no_expire), so if user (php user) sent Expire header before

Re: [PHP-DEV] I would like to write an RFC for the addition of an internal keyword

2013-02-27 Thread Nikita Nefedov
On Wed, 27 Feb 2013 11:07:06 +0400, Jens Riisom Schultz ibmu...@me.com wrote: Hi, I just want to get a feel for whether the following idea would be instantly rejected (for example I get the feeling that adding keywords is a big deal): Often, when writing frameworks, you need to make

Re: [PHP-DEV] Late FQCN resolution using ::class

2013-02-25 Thread Nikita Nefedov
On Mon, 25 Feb 2013 14:00:04 +0400, Jens Riisom Schultz ibmu...@me.com wrote: Hi everybody, I have read up on this, and done some testing. First up, my findings with PHP5.5 alpha5: ?php namespace spacy; class classy { public static function fqcn() { /* This works

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On 20.02.2013, at 1:42, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: Seems this would complicate the transplanting of (global) functions into (default public) class methods and vice versa. This is a common refactoring task -- at least IME -- and before I adjust

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On Wed, 20 Feb 2013 08:02:36 -, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: While I'm thinking about this (though I should leave it alone): who's to say that PHP won't some day get inner classes? By deciding the default inner member of a class will be a

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-20 Thread Nikita Nefedov
On Wed, 20 Feb 2013 09:59:51 -, Sanford Whiteman swhitemanlistens-softw...@cypressintegrated.com wrote: Classes always should be declared with class keyword, because there could be ambiguity whether it's class, interface or trait. If only inner classes are allowed in a given PHP

Re: [PHP-DEV] [RFC] Short syntax for anonymous functions

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 16:31:39 -, Marcello Duarte mdua...@inviqa.com wrote: On 19 Feb 2013, at 16:29, Morfi wrote: ($n) = { echo $n; } ($n) use ($m) = { echo $n; } Morfi, the problem pointed out already is when you have no arguments it would be the same as the statement block, which

[PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
Hi! As someone mentioned in the thread about short syntax for closures, we could also drop requirement for `function` keyword when defining/declaring methods in classes, interfaces or traits. I have long noticed how redundant it is. The patch is pretty easy as it was with commas :) It is

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 17:53:40 -, Johannes Schlüter johan...@schlueters.de wrote: I agreed to the conclusion that the function keyword provided a nice way to grep for functions when handling foreign code and leaving it out only provides little improvement in less typing. Please provide new

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
(just for the sake of understanding) https://gist.github.com/nikita2206/4988665 But I will add an actual tests if it's going to receive some support. On Tue, 19 Feb 2013 18:41:41 -, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/19/2013 02:39 PM, Nikita Nefedov wrote: About 20-30 times

Re: [PHP-DEV] Dropping requirement for `function` keyword for methods in classes/interfaces/etc

2013-02-19 Thread Nikita Nefedov
On Tue, 19 Feb 2013 19:10:22 -, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/19/2013 03:07 PM, Nikita Nefedov wrote: Are you grepping for all the functions or you are grepping just for some specific function? If so, you are likely already know what visibility this function has, so

Re: [PHP-DEV] - True Annotations

2013-01-09 Thread Nikita Nefedov
No please, two symbols for each side looks ugly. BTW There's number sign (#) which is, as far as I remember, not used in PHP at all. Could be something like: #JoinColumn(name=..., type=..., ...) #Foo(Bar()) Or #Foo(#Bar()) (should we put a annotation-sign in front of a nested annotation?)

[PHP-DEV] Ruby's symbols

2013-01-05 Thread Nikita Nefedov
I know I shouldn't write Ruby in the subject of a letter for php-internals ML, but... Just wanted to ask, is anybody interested in this feature in PHP? You can read about it here: http://www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol It can be implemented in

Re: [PHP-DEV] Ruby's symbols

2013-01-05 Thread Nikita Nefedov
symbols are (I don't know much about Ruby) Cheers,Victor 2013/1/5 Nikita Nefedov inefe...@gmail.com array( 'label' = 'Comment', 'required' = false, 'property_path' = 'properties.comment' ) Hi,PHP arrays are always ordered (they actually are doubly-linked lists and hash

Re: [PHP-DEV] Ruby's symbols

2013-01-05 Thread Nikita Nefedov
On Sat, 05 Jan 2013 12:21:26 -, Nikita Popov nikita@gmail.com wrote:On Sat, Jan 5, 2013 at 3:07 PM, Nikita Nefedov inefe...@gmail.com wrote: What symbols can give: 1. More convenient way to use it almost everywhere as a replacement for strings and sometimes for constants. There's a lot

Re: [PHP-DEV] DateTime improvement

2012-12-21 Thread Nikita Nefedov
I don't think it would be ok to move just DateTimeImmutable to the namespace. There were proposal to move all the php functions and classes in namespaces, so that for example str_replace() could be \Str\replace() and array_map() could be \Array\map() and so on. On Fri, 21 Dec 2012 12:33:04

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Nikita Nefedov
Hi! Date is immutable, but there's no reason why date object should be able to represent only one date. Reference to Java is not exactly applicable here, as many problems existing in Java (thread safety, long-living object references, etc.) do not exist in PHP. Say we have a blog post entity,

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Nikita Nefedov
On Mon, 10 Dec 2012 16:09:36 +0400, Christian Stoller stol...@leonex.de wrote: Hi internals, what do you think about improving the modification functionality of the DateTime class. I always get a cold shiver, when I write something like this: ?php $date = new DateTime()

[PHP-DEV] DateTime improvement

2012-12-10 Thread Nikita Nefedov
So there had been at least two or three messages (subjects) about DateTime object and everytime there was this problem - people tend to take DateTime object as mutable object and it really is. As long as we know, it's not so good - date is immutable by nature. I don't want to write here why

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Nikita Nefedov
On Mon, 26 Nov 2012 15:06:09 +0400, Ivan Enderlin @ Hoa ivan.ender...@hoa-project.net wrote: Hi internals, I would to modify a \DateTime object to the current time, thus I wrote this: $d = new \DateTime('+1 hour'); $d-modify('now'); It did not work. Why? Because the documentation

Re: [PHP-DEV] Changing the default value of true for CURLOPT_SSL_VERIFYHOST

2012-10-25 Thread Nikita Nefedov
CURLOPT_SSL_VERIFYHOST - this option just sounds like should I verify host?, when it must sound like what verifying strategy should I use? On Thu, 25 Oct 2012 10:19:24 +0400, Adam Harvey ahar...@php.net wrote: On 25 October 2012 13:46, JJ ja...@php.net wrote: On Wed, Oct 24, 2012 at 10:34

Re: [PHP-DEV] Generics proposal

2012-10-21 Thread Nikita Nefedov
No, this is useful in any OOP-language where there is such thing as type, and people need to validate types. I unerstand what you are saying about PHP being an easy language, but in opinion if you don't want to use that feature you can not use it, as you can not use typehinting in functions

Re: [PHP-DEV] Generics proposal

2012-10-21 Thread Nikita Nefedov
I actually don't have much experience with generics, so won't argue about their readability, but this article is all about Java's implementation of generics, so I don't know how much sense this article gives in that context. But it's ok, I see just one person that supported proposal. I think