Objects or structures.
NEW MEME GUYZ LOLCAT
BTW MEMBERS
I HAS A CAT!PIC
I HAS A CAPTION
BTW CONSTRUCTOR
FORCED MEME LOLCAT WITH HEAD ALSO SHOE LOL
HAI
CAT!PIC IZ HEAD
CAPTION IZ SHOE
PUT CAPTION ON CAT!PIC
KTHXBYE
BTW DEFAULT CONSTRUCTOR
FORCED MEME LOLCAT
HAI
ME WITH CEILING!CAT ALSO "Ceiling cat is watching you masturbate" LOL
KTHXBYE
BTW OBSERVERS
SO IM LIKE PICTUREGET
HAI
I FOUND TEH CAT!PIC
KTHXBYE
SO IM LIKE FUNNYTEXTGET
HAI
I FOUND TEH CAPTION
KTHXBYE
BTW MUTATORS
SO IM LIKE NEWTEXTPLZ WITH FUNNYTEXT
HAI
CAPTION IZ FUNNYTEXT
KTHXBYE
SO IM LIKE MOARTEXTPLZ WITH FUNNYTEXT
HAI
CAPTION IZ CAPTION N FUNNYTEXT
KTHXBYE
SO IM LIKE GIMME!ROFFLES
HAI
BTW THIS DISPLAYS THE FUNNY PIC WITH OMGTEXT!
KTHXBYE
KTHXBYE
OMG, That's TEH AWESOME!!1! That reads so sweetly! — Risser, 2007/05/29 18:35
So how do we use the new meme? Perhaps:
BTW Using the default constructor I HAS A BLAHLOLCAT ITZ A LOLCAT BTW Using the constructor I HAS A GR8LOLCAT ITZ A LOLCAT WITH MYCATPIC ALSO "I CAN HAZ CODING?" BTW Accessing functions I HAS A STOLENPIC IZ PICTUREGET DA GR8LOLCAT NEWTEXTPLZ DA BLAHLOLCAT WITH "ZZZZ"
I'm not sure what to do for accessing members. “DA” works great for verbs, but not nouns.
— Isaac, 2007/05/30 16:48
I nominate some form of “HAS (A) FLAVOR” for OOPy construction. It sort of matches the OO idea, and one of the first OO systems for LISP was called 'FLAVORS', which is a nifty historical nod.
My mastery of lolcat is such that I feel confident in offering a syntax just now.
— wm, 2007/05/30 17:06
So, new ideas from downtime yesterday.
Optional syntax for observers that take either no arguments or one integer literal:
IM SO [object name] I SHIT (THE) [field name]
where the “THE” is optional for smoothness of reading. For example,
NEW MEME GUYZ MONARCHY
I HAS A KING
I HAS A QUEEN
FORCED MEME MONARCHY
HAI
BTW TEXT GOES HERE
KTHXBYE
END MEME
Therefore,
I HAS A BRITISH I HAS A TRUTH BRITISH IZ FORCED MEME MONARCHY TRUTH IZ IM SO BRITISH I SHIT THE QUEEN
This also addresses the possibility of needing a command to access members.
Since LOLCODE thus far has been loosely/dynamically typed, I'm inclined to simply allow an object to be of the class that it uses the constructor for. For example, as above, BRITISH is a variable that happens to be assigned the product of a MONARCHY constructor, much as we need not declare for
I HAS A BUKKIT BUKKIT IZ "OMG! STOLEN!"
As for calling methods, I'm thinking of
I HAS A CEILINGCAT CEILINGCAT IZ FORCED MEME LOLCAT BTW HA! HA! IM USIN UR DEFAULT CONSTRUCTOR IM IN UR CEILINGCAT, MAKIN U GIMME!ROFFLES BTW DISPLAYS THE CEILINGCAT FUNNIES IM IN UR CEILINGCAT, MAKIN U NEWTEXTPLZ UR "Where is your god now?" LOL BTW IM CALLIN UR METHOD WITH ONE ARGUMENT, LOL
As before, additional arguments can be appended by using “ALSO <argument>”. I've also been using “LOL” as a delimiter for the end of a list of items (usually in a function call), as in the two-argument constructor for LOLCAT.
Should static methods be “SO ITZ LIKE…” instead of “SO IM LIKE”?
— Tammi C., 2007/05/30 17:38
For storing objects in variables, I have proposed to use ITZA or IZA (as in, “it is a” or “is a”)
I HAS A ceilingcat ITZA lolcat I HAZ A monorailcat monorailcat IZA lolcat
This would also call the constructor.
I still like
I HAS A [<class/type> CALLED] <varname> [AN]ITZ <value>[ ALSO/WITH/AN[D] ]
for initializer statements, with
LOL <variable>['S <member>] R <value>
for assignment. For the former, if no type is specified, the interpreter or compiler will either choose type NUMBAR or YARN (string) automatically. I still propose that the language be strongly typed, with the following for casting:
... <type>!AZA!<type> ...
and no implicit casting. — Kyle, 2007/05/30 18:47
Has anyone considered using DOOD for 'class'?
DOOD CAR I HAS A VAR DOORS KTHX DOOD CORVETTE SO IM LIKE CAR VAR DOORS IZ 2 KTHX DOOD CADILLAC SO IM LIKE CAR VAR DOORS IZ 4 KTHX
-scoyote, 2007/05/30 19:08
For deallocation of these objects (if dynamic memory allocation is used), I'll propose using “IZ NOT A MEME”. Building off of Tammi C.'s code from above:
I HAS A CEILINGCAT CEILINGCAT IZ FORCED MEME LOLCAT BTW HA! HA! IM USIN UR DEFAULT CONSTRUCTOR IM IN UR CEILINGCAT, MAKIN U GIMME!ROFFLES BTW DISPLAYS THE CEILINGCAT FUNNIES BTW DELEETIN UR OBJECT AMIRITE CEILINGCAT IZ NOT A MEME
-belx, 2007/05/30 21:24
Just suggested that NOOB could be used instead of new
— Spikeline, 2007/06/02 22:46
Deallocation? Let's keep lolcode simple and hide memory troubles from the programmer (Java-like).
— Nicolas, 2007/06/05 22:12