Cuallito
Jun 11th, 2001, 02:32 PM
These are some samples from a programming language that i'm thinking about amking, I'm calling it PHOIL for Polymorphic Hierchial Object Instruction Language. Please post any comments or critisism, just not anything like "Its OK".
//Hello world program
include "std.plh" /* Standard header for Phoil progs.
All most everything will come from a header file
Like in C++ */
//main is the startup object in phoil progs
main is textout("Hello World\n"); //;Blocks of code
// is makes the main object 'be' textout("Hello World\n")
Was that so bad?
include "std.plh"
/*An object can contain many elements (like sequences in euphoria).
An element can be named or unamed, receive arguments, and return values.
An element with the same name of the object is the constuctor
and an element with the name of the object and a ~ before it is the deconstructor */
main = {
private Tom=New Surfer
::main() //constructor
Tom::Cool!()
Tom[0]() //Same as above
//You can also access elements like elements of arrays in C
Tom::Money(Tom(3))
::~main() //deconstructor
Tom = nothing //nothing is {}
}
Surfer = { /* Phoil has bad grammer rules :p
This object doesn't need a constructer
(there are no variables. All elements are public by
default */
::Cool!() //! isn't a special character
textout("Whoa, Cool!\n")
textout("That's totalllly chilin'\n ")
| //new element character
::Dude()
textout("Sweeet dude!\n")
|
3 //unamed data
|
::money(howmuch)
/* there is only one type of data in phoil: objects */
textout("Can I have" & 'howmuch' & "dollars")
|
::static private smoke_weed() //you get the idea
/*To use functions simply put return n somewere in them. To use
events just do ::Event foo(x,y,z) or whatever /*
}
Do you like?
include "std.plh"
//Demonstrates Polymorphism in Phoil and Heirarchy
main is
private a ,b ,c // all variable are set to {} unless
//otherwise specified
a is textout("Eat Cheese");
b is textout("Water is clear");
c={a,{a,b}}
/* c is now
c={
textout("Eat Cheese"),{textout("Eat Cheese"),textout("Water is clear")}}
*/
c[0] //prints Eat Cheese on the screen
c[1] //prints Eat Cheese AND Water is clear on the screen
c[1,0] //Prints Eat Cheese on the screen
c[1,1] //Prints Water is clear
;
Well, what do you think?
//Hello world program
include "std.plh" /* Standard header for Phoil progs.
All most everything will come from a header file
Like in C++ */
//main is the startup object in phoil progs
main is textout("Hello World\n"); //;Blocks of code
// is makes the main object 'be' textout("Hello World\n")
Was that so bad?
include "std.plh"
/*An object can contain many elements (like sequences in euphoria).
An element can be named or unamed, receive arguments, and return values.
An element with the same name of the object is the constuctor
and an element with the name of the object and a ~ before it is the deconstructor */
main = {
private Tom=New Surfer
::main() //constructor
Tom::Cool!()
Tom[0]() //Same as above
//You can also access elements like elements of arrays in C
Tom::Money(Tom(3))
::~main() //deconstructor
Tom = nothing //nothing is {}
}
Surfer = { /* Phoil has bad grammer rules :p
This object doesn't need a constructer
(there are no variables. All elements are public by
default */
::Cool!() //! isn't a special character
textout("Whoa, Cool!\n")
textout("That's totalllly chilin'\n ")
| //new element character
::Dude()
textout("Sweeet dude!\n")
|
3 //unamed data
|
::money(howmuch)
/* there is only one type of data in phoil: objects */
textout("Can I have" & 'howmuch' & "dollars")
|
::static private smoke_weed() //you get the idea
/*To use functions simply put return n somewere in them. To use
events just do ::Event foo(x,y,z) or whatever /*
}
Do you like?
include "std.plh"
//Demonstrates Polymorphism in Phoil and Heirarchy
main is
private a ,b ,c // all variable are set to {} unless
//otherwise specified
a is textout("Eat Cheese");
b is textout("Water is clear");
c={a,{a,b}}
/* c is now
c={
textout("Eat Cheese"),{textout("Eat Cheese"),textout("Water is clear")}}
*/
c[0] //prints Eat Cheese on the screen
c[1] //prints Eat Cheese AND Water is clear on the screen
c[1,0] //Prints Eat Cheese on the screen
c[1,1] //Prints Water is clear
;
Well, what do you think?