Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP lambdas: Bitch & Whine.

Name: Anonymous 2008-10-12 19:51

Why the FUCK can't I assign functions to magic methods?
% php -r 'class Whut{function __construct(){ $this->__call = function ($m, $v) { echo "Calling: ", $m; }; } } $n = new Whut; $n->whut();'
Fatal error: Call to undefined method Whut::whut() in Command line code on line
1


Wait, I can't even use them as methods?
% php -r 'class Whut{function __construct(){ $this->__call = function ($m, $
v) { echo "Calling: ", $m; }; } } $n = new Whut; $n->__call("whut", array());'
Fatal error: Call to undefined method Whut::__call() in Command line code on lin
e 1


And, dude, what the shit!?
% php -r 'function lol(){return function () {echo "Hello."; }; } lol()();'
Parse error: syntax error, unexpected '(' in Command line code on line 1


Ok, how about...
% php -r 'function lol(){return function () {echo "Hello."; }; } (lol())();                       $n();'
Parse error: syntax error, unexpected '(' in Command line code on line 1


So, I abso-fucking-lutely have to assign it?
% php -r 'function lol(){return function () {echo "Hello."; }; } $n = lol();
 $n();'
Hello!


Oh, screw you, god damn faggots.

Name: Anonymous 2008-10-12 20:06

Go back to javascript

Name: Anonymous 2008-10-12 20:08

Name: Anonymous 2008-10-12 20:32

$ php -r 'class N { function __construct($f) { $this->___call=$f; } } $a = new N(create_function("", "return 1;")); $a->__call();'

Fatal error: Call to undefined method N::__call() in Command line code on line 1


Spoilers: PHP does not work that way.

Name: Anonymous 2008-10-12 21:00

It should.

Name: Anonymous 2008-10-12 21:04

Object-oriented PHP is a sad disorder.

Name: Anonymous 2008-10-12 22:47

What the fuck, PHP. Classes don't fucking have functions, they have methods. What the fuck. I can't fucking believe this. Ugh, I'm so fucking mad at PHP right now. Fuck this.

Name: Anonymous 2008-10-13 0:14

>>7
Methods are just functions belonging to a struct.

Name: Anonymous 2008-10-13 0:24

>>8
Fuck off, Xarn.

Name: Anonymous 2008-10-13 1:19

>>8
structs can contain function pointers, but not functions.

Name: Anonymous 2008-10-13 2:55

>>10
Overly literal-minded faggot is overly literal-minded.

Name: Anonymous 2008-10-13 17:23

>>10
If you want to get technical, there are no such things as methods or structs or classes. Just functions which take in an additional pointer to some allocated space.
Doesn't sound so hot now, does it punk?

Name: Anonymous 2008-10-13 23:48

>>12
Oh look, how cute, a seppler! He sees the world in bits and bytes. He deals not in abstractions more powerful than the occasional vtable.

Name: Anonymous 2008-10-14 11:34

>>13
He also probably gets shit done, and makes money doing it, unlike the basement dwelling faggots who seem to comprise most of the population of /prog/

Name: Anonymous 2008-10-14 15:41

>>14
Because C++/Javaers with their broken object systems and feckless patterns are known for being masters of not tediously reimplementing trivial functionality and getting shit done.

Name: Anonymous 2008-10-14 20:56

>>15

Step 1. Remove Head From Ass
Step 2. Look At Any Major Commercial App, Notice Something?
Step 3. ???
Step 4. PROFIT!!!

Name: Anonymous 2008-10-14 21:09

>>16
I notice it's slow and buggy, and took more time and money to develop than they ever wanted it to. Step 3 is: write your programs in Lisp instead.

Name: Anonymous 2008-10-14 21:15

>>17
The Sea The Sea! Lost in Parenth's Sea!

Name: Anonymous 2008-10-15 4:25

>>12
HAS READ SICP

>>13
FAILED SICP

Name: Anonymous 2008-10-15 4:29

Step 2. Look At Any Major Commercial App, Notice Something?
I notice that it's written in C.

Name: Anonymous 2008-10-15 5:14

>>12
There is no such thing as functions, just memory locations and a return address on the stack.

Name: Anonymous 2008-10-15 5:51

>>21
There's no such thing as a stack, just instructions to load or store a value using indirect addressing and increment or decrement the index register.

Name: Anonymous 2008-10-15 6:35

>>23-46 *SNIP*

There is no such thing as matter, only strings vibrating.

Name: Anonymous 2008-10-15 7:23

>>23
There is no such thing as a string, only ceiling cat.
/thread

Name: Anonymous 2008-10-15 7:58

>>24
Back to /an/, please

Name: Anonymous 2010-11-26 14:41

Name: Anonymous 2011-02-03 2:15

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List