|
-
Jun 11th, 2001, 02:32 PM
#1
Thread Starter
Addicted Member
Phoil!
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".
Code:
//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?
Code:
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?
Code:
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?
Last edited by Cuallito; Jun 11th, 2001 at 06:08 PM.
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
Jun 11th, 2001, 02:43 PM
#2
Hyperactive Member
Interesting (See, I didn't say "It's okay")
It's very C,C++ based (which isn't a bad thing), but what really does your language add that would encourage people to use it. It suffers from alot of the unreadability of C.
If almost every file is going to need the std.plh library, then why not include it automatically. (You can always provide an exclude command if you really want).
You could take the opportunity to move away from the top to bottom programming style of most other languages (C, VC++ and VB). Why should you define a main proc when you could have a seperate window and hot key for it.
You could also have a hierachical structure for defining classes etc.
Just some thoughts on a lazy Monday afternoon

Good luck with the language.
SD
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
-
Jun 11th, 2001, 03:07 PM
#3
Thread Starter
Addicted Member
ok
How about:
Instead of :: for declaring members, how about a 'member' keyword, that would eleminate :: and |. Can any1 think of a more elegant way to define objects than using 'is' and '=' ? And instead of :: and [] for accessing members, maybe just [] will work. The power of phoil is that it's objects can be 'reshaped' at runtime, and that there is only 1 data type: objects. Objects can emulate arrays, classes, types etc (think OO Euphoria). Thanks for the comments SD.
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
Jun 11th, 2001, 03:23 PM
#4
Monday Morning Lunatic
My 1.7pence - for strings force them Unicode. Don't mess around with ANSI/Unicode conversions. Make the programmer always use Unicode. It give it much more mature I/O features.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|