I don't understand why you need to introduce two new keywords into the
language - * and yield. Could you not solve it like follows?
// Generator implements Iterable
class AllEvenNumbers extends Generator {
private $i;
public __construct() { $this->i = 0; }
function generate() {
return
Hi,
as i've mentioned, that's up to implementation, for more infos please pay
attention to
http://en.wikipedia.org/wiki/Coroutine#Implementations_for_C
Well, the libtask mentioned there isn't thread safe (but could be made).
Especially have earned some attention
http://msdn.microsoft.com/en-us
Can you really use setjmp and longjmp in that way safely? I thought it
was only safe to longjmp "back," not "forward" - you can use them to
fake exception support but that's it because you'll smash the stack
otherwise. Something like that...
OK, I'm thinking of this:
"Similarly, C99 does not requ
On 11/06/12 20:13, Stas Malyshev wrote:
Hi!
Can be:
$var = 'abc';
echo $var[-1];
This seems simple enough for a hard-coded -1, but...
Would $var[-2] be strlen($var) - 2 and so on?
The main question is what happens with "foo"[-4] or ['x'][-2].
And then one would expect some rather complex l
On 11/06/12 20:28, Richard Lynch wrote:
On Mon, June 11, 2012 2:13 pm, Stas Malyshev wrote:
And then one would expect some rather complex logic to compute -N
for
$var[-N]
I don't see much of complex logic here, but $a[2] = 'a' would create a
new array element if it does not exist, while $a[-2]
Hi,
it'd be really cool if the implementation would do the "real" context
switch in c, which would be the true basis for spl_coroutine. The current
implementation seems not to do that.
Context switch in c would be comparable with threads. In fact coroutines
would be a comensation for lacking thre
On Mon, Jun 11, 2012 at 12:13 PM, Stas Malyshev wrote:
> Hi!
>
> >> Can be:
> >> $var = 'abc';
> >> echo $var[-1];
> >
> > This seems simple enough for a hard-coded -1, but...
> >
> > Would $var[-2] be strlen($var) - 2 and so on?
>
> The main question is what happens with "foo"[-4] or ['x'][-2].
>
On Mon, June 11, 2012 2:13 pm, Stas Malyshev wrote:
>> And then one would expect some rather complex logic to compute -N
>> for
>> $var[-N]
>
> I don't see much of complex logic here, but $a[2] = 'a' would create a
> new array element if it does not exist, while $a[-2] can't. Not a big
> issue, but
Hi!
>> Can be:
>> $var = 'abc';
>> echo $var[-1];
>
> This seems simple enough for a hard-coded -1, but...
>
> Would $var[-2] be strlen($var) - 2 and so on?
The main question is what happens with "foo"[-4] or ['x'][-2].
> And then one would expect some rather complex logic to compute -N for
>
On Mon, June 4, 2012 2:08 pm, Marc Easen wrote:
> I have submitted a patch to support negative indexs in strings, as per
> the conversation adding them to arrays could possibly detract from the
> syntactical sugar they are indented to be.
>
> In summary:
>
> An alternative to:
> $var = 'abc';
> ech
10 matches
Mail list logo