Well, here are some ideas I've had for the RTL so far.
STDIO.LOL
HAI LIBRARY
SO IM LIKE GIMMEH GIVING BACK RESULT
^^ This function returns a result.
^^ Results can be used as follows:
^^ 1) Discard the result.
^^ GIMMEH
^^ 2) Store the result on left hand side.
^^ I HAS A VAR IZ GIMMEH
^^ 3) Store the result on right hand side.
^^ GIMMEH VAR
SKELETON
SO IM LIKE TXT GIVING BACK RESULT
^^ ME A could possibly be considered whitespace:
^^ TXT ME A VAR
RESULT IZ GIMMEH
KTHX
SO IM LIKE LOL WITH JK
^^ Appends new line only if JK has a ! on the end.
^^ Final ! is not printed.
^^ LOL "My text."!
SKELETON
SO IM LIKE VISIBLE WITH USERINFO
^^ Always appends new line.
LOL USERINFO!
KTHX
SO IM LIKE BTW WITH DEBUGINFO
^^ Always appends new line.
SKELETON
L8R LIBRARY
SYSTEM.LOL
HAI LIBRARY
^^ System.lol is included in every program.
SO IM LIKE HALP WITH EXCEPTIONINFO
^^ HALP raises an exception. There is no other way
^^ to raise an exception.
SKELETON
L8R LIBRARY
FILEZORZ.LOL
HAI LIBRARY
ALL UR BASE R BELONG 2 FILE
^^ Class definition.
^^ The following fields and methods belong to the FILE class:
SO IM LIKE OPEN WITH FILENAME GIVING BACK RESULT
SKELETON
SO IM LIKE CREATE WITH FILENAME GIVING BACK RESULT
SKELETON
^^ Constructor SKELETONs to be inserted by compiler.
^^ SO IM LIKE KILL YOURSELF
^^ SKELETON
^^ All objects have destructors. No need to specify one here.
^^ (Thats why it's commented out.)
^^ They all look the same, and the compiler will add this one in.
KTHX
L8R LIBRARY
PARALLEL.LOL
HAI LIBRARY
^^ Library name will be the file name. E.g. PARALLEL.LOL
^^ This PARALLEL library is actually implemented by the compiler.
^^ Only the method definitions "SKELETONs" are here to help IDE's etc.
SO WHOZ LIKE SLEEPIN WITH MAXSECONDS GIVING BACK RESULT
^^ Notice the WHOZ instead of IM. WHOZ means that you must insert a subject
^^ before calling this function. e.g. IZ I SLEEPIN 10 O RLY?
^^ Where I is the subject.
^^ "I" or "IM" mean the current thread.
^^ Alternatively, IZ MYNETWORKSOCKETREADER SLEEPIN 10 O RLY?
^^ Also, IM SLEEPIN 10
^^ Also, I IZ SLEEPIN 10, the IZ here would be ignored.
^^ SLEEPIN is a low level function to *wait* for an event.
^^ Waits up to a maximum of MAXSECONDS seconds. When MAXSECONDS is 0.5, that
^^ would mean half a second.
^^ Returns *before* MAXSECONDS has elapsed with NO WAI if an event was found.
^^ So basically it returns immediately as soon as an event is found.
^^ Returns YA RLY after MAXSECONDS seconds if *no* events were found.
^^ Consider the FOREVER constant for MAXSECONDS.
SKELETON
SO WHOZ LIKE ONEEVENT GIVING BACK RESULT
^^ ONEEVENT is a low level function to *process* an event if one is available.
^^ ONEEVENT returns one of the following:
^^ 0 If the thread *should* terminate as soon as possible.
^^ 1 If there were no events available to process.
^^ 2 If it processed an event.
SKELETON
L8R LIBRARY
EVENTUTILS.LOL
HAI LIBRARY
^^ Library name will be the file name. E.g. EVENTUTILS.LOL
CAN HAS PARALLEL?
^^ Low-level threading-related functions e.g. ONEEVENT and SLEEPIN.
SO WHOZ LIKE EVENTS GIVING BACK RESULT
^^ WHOZ parameter is accessed using SUBJECTZ.
^^ Function EVENTS processes all pending events, returns NO WAI if
^^ the subject *should* terminate as soon as possible. Otherwise
^^ returns YA RLY if it should carry on.
IM IN YR LOOP
WTF IZ SUBJECTZ ONEEVENT?
OMG 0
RESULT IZ NO WAI
^^ Setting result causes function exit.
OMG 1
RESULT IZ YA RLY
^^ Setting result causes function exit.
OMG 2
^^ Processed an event, just carry on.
0WND
WTF!
HALP "Unexpected code flow."
KTHX
IM OUTTA YR LOOP
HALP "Unexpected code flow."
^^ Should turn that "Unexpected code flow." into a function..
KTHX
SO WHOZ LIKE BLOCKEVENT GIVING BACK RESULT
^^ Function BLOCKEVENT processes one event. If an event is not available.
^^ then it will wait for one to be available.
^^ Returns NO WAI if
^^ the subject *should* terminate as soon as possible. Otherwise
^^ returns YA RLY if it should carry on.
IZ SUBJECTZ SLEEPIN FOREVER O RLY?
YA RLY
HALP "Unexpected code flow."
^^ How can it have successfully finished sleeping forever?
NO WAI
^^ Sleep was interrupted by an event.
WTF IZ SUBJECTZ ONEEVENT?
OMG 0
RESULT IZ NO WAI
OMG 2
RESULT IZ YA RLY
WTF!
^^ And yes, OMG 1 is meant to not be there.
HALP "Unexpected code flow."
KTHX
KTHX
KTHX
SO WHOZ LIKE RUNNIN
^^ Function RUNNIN is a utility for event based applications.
^^ It returns when the application is complete.
IM IN YR LOOP
IZ SUBJECTZ BLOCKEVENT O RLY?
YA RLY
^^ Thread can carry on.
NO WAI
^^ Thread must end soon.
BECOME AN HERO
^^ *LOOP* break.
KTHX
IM OUTTA YR LOOP
KTHX
L8R LIBRARY
FORMS.LOL
HAI LIBRARY
ALL UR BASE R BELONG 2 COMPONENT
KTHX
ALL UR BASE R BELONG 2 BUTTON TEH MUTANT COMPONENT
^^ Class name is BUTTON, inherits from COMPONENT.
I HAS A CLICKIN IZ WHOZ
^^ Field CLICKIN contains a pointer to a method.
^^ WHOZ means a METHOD that has a WHOZ e.g.
^^ SO WHOZ LIKE MYMETHOD
^^ SUBJECTZ THEFIELD IZ "THEVALUE"
^^ KTHX
^^ However the following would be incompatible:
^^ SO WHOZ LIKE MYMETHOD WITH VAR
^^ KTHX
^^ Because the parameter signatures differ.
^^ To make this work, the declaration would have to be:
^^ I HAS A CLICKIN IZ WHOZ WITH VAR
^^ Imagine writing a compiler to handle that lol.
KTHX
ALL UR BASE R BELONG 2 FORM
SO IM LIKE MAKE WITH MAH COMPONENTS BUKKIT GIVING BACK RESULT
^^ Components is array of buttons/edits etc. to place on the form.
^^ If any of the components IZ NOTHING, then that component will be
^^ created with a generic mutatable component class, and then mutated
^^ when its events are set.
SKELETON
^^ Constructor.
KTHX
L8R LIBRARY
EVENTTEST.LOL
HAI
CAN HAS PARALLEL?
CAN HAS EVENTUTILS?
CAN HAS FORMS?
SO WHOZ LIKE CLICKEVENT
SUBJECTZ CAPTION IZ "Here"
^^ Change the button's caption.
^^ The button is passed through WHOZ into SUBJECTZ.
^^ SUBJECTZ is the button.
SLEEPIN 1
SUBJECTZ CAPTION IZ "Gone"
KTHX
^^ Declare some events
PLZ MAKE FORM WITH BUTTON?
^^ Create a form with a button and show it
^^ BUTTON is the variable name, NOT the class name.
^^ Class is detected automatically by the event assignment below.
^^ A variable with only "CLICKIN" assigned will obviously be a button.
^^ While a variable with only "TEXTIN" will obviously be an edit.
^^ (one line text box)
AWSUM THX
^^ Successfully created the form.
BUTTON IZ CLICKIN MAH CLICKEVENT
^^ Assign the event for use.
I IZ RUNNIN
^^ Allow the user to click the button, or close the form.
^^ Please note that form events are redirected to the
^^ current thread's event queue, which is why its
^^ "I" IZ RUNNIN and not "FORM" IZ RUNNIN
KTHX
^^ Clean up the form and its contents.
KTHXBYE
-skiy
----
Lots of good stuff here, but not all of it is v1.0 compliant. First of, to access a function within an object within an object you would say
object1 IN UR object2 function
BTW Example
IZ object 1 IN UR object2 SLEEPING 10 ?
This means that you don't actually have to specify that a function needs to be within an object.
Second, I like SKELETON (Interface, right?) and MUTANT (extends?). Great ideas.
There is an example of how events could be handled ([[caturday]]), this could be implemented into your libraries.
--- //Marius, 2007/05/31 10:24//