Prothon - A New Prototype-based Language
Ben Collins writes "Prothon is a new industrial-strength, interpreted, prototype-based, object-oriented language that gets rid of classes altogether in the way that the Self language does. It uses the sensible, practical syntax and add-on C module scheme from Python. This major prototype improvement over Python plus many other general improvements make for a clean new revolutionary breakthrough in language development. Prothon is simple to use and yet offers the combined power of Python and Self. Check out the first public pre-alpha release at prothon.org."
A pre alpha release really isn't newsworthy. Is this some one's pet project? I wasn't aware Python was broken.
Thalasar
Sounds like a korean car.
Watch this Heartland Institute video
call it "Industrial-Strength" if it's "pre-alpha?"
All Your Memory Are Belong To Java
Yet Another New and Improved Scripting Language! Just what we needed!
Oops, did I say that out loud?
Maybe they should write a new webserver in Prothon... to survive the slashdotting...
Need to? I find most people that brag about knowing a dozen languages never really use any one of them.
See also: jack of all trades, master of none.
Tom
Someday, I'll have a real sig.
with the "witty" names again. Anyway, can someone explain to me how eliminating classes is better? I thought that implementing classes, the OOP approach, was the better way to go.
They don't really explain why their way is better. They just state it as though it was a matter of fact.
Make your vote count
Call me when Producthon is ready.
Analogies don't equal equalities, they are merely somewhat analogous.
Obviously, the web server is not industrial strength, at least not /.proof.
As for industrial strength of the langage, knowing some industry guys, some pre alpha system is certaintly not ready.
I didn't see much in the way of code examples on the site. The "no classes" thing confused me and I would have loved to see some example Prothon code that accomplishes the kinds of things that I would have used a class for, in Python.
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
What's with all these languages that start with 'p'? perl, python, php, not to mention good old pascal, and now prothon. Is there a joke here that I'm missing?
Prothon is a new industrial-strength, interpreted, prototype-based, object-oriented language
Haven't seen so many buzzwords in one sentence for a long long time...
This is taken from the Prothon Description
Like Python, Prothon uses indentation to control the block structure of the program instead of block/end or {}. However, Prothon only allows tabs for indentation. Any space in an indent will cause an error.
Classic bondage-and-discipline. Why oh why is this so ??
I hear there's rumors on the Slashdots
Prothon Description:
/* and */. This is useful for temporarily blocking out large blocks of code and inserting inline comments.
/*no response*/ or is_too_long:
.get_hdr(text): # define func "get_hdr" as attribute of self .text = text # attribute "text" loaded from local "text" .hdr = Mime
This document assumes a working knowledge of Python. Many features are described as differences to Python features. If you are new to Python, a good starting point can be found at www.python.org.
Comments
Standard Python comments using the # character work exactly the same in Prothon. Prothon also supports the C comment format of
# this line is a comment
x=5 # this is a trailing comment
if not rlst
Indentation is Tab-Only
Like Python, Prothon uses indentation to control the block structure of the program instead of block/end or {}. However, Prothon only allows tabs for indentation. Any space in an indent will cause an error. This allows each programmer to set the editor to show the tab width to whatever he pleases and the Python problems of mixed spaces and tabs cannot happen in Prothon. It also allows for minimum typing.
Line Continuation
A line can be continued by placing a backslash ( \ ) as the last character of a line as in Python. Also, any tab indent of more than one level deeper than the previous indent level will cause the line to be considered a continuation of the previous line, which is a new feature to Prothon. The automatic continuation of lines in comma separated lists found in Python is not allowed in Prothon because of parsing differences, but usually the auto-continuation from indents alleviates the need for this.
Note that you can put spaces after tabs when in an auto-continuation. This allows you to line up the continued line for appearance.
x = 1 + 2 + 3 + 4 + \
5 + 6 + 7 + 8 + 9 # backslash continuation
s = "this is a normal line \
this is a continuation" # backslash works in quotes
y = long_function_name() +
another_function_name() # extra indent continuation
z = function_name(variable_name_1, # this is legal in Prothon because
variable_name_2) # of extra indents, not commas
Variable Names and Scope (No more "self variable")
The syntax for a variable name (label) is the same as Python except that one exclamation mark is allowed at the end and only at the end. This usage should be reserved for functions that modify the object's content in place. This allows a function such as list.sort!() to return the modified list, which was not allowed in Python. One should ALWAYS use this naming convention for in-place modification functions to warn programmers.
Prothon has a very different concept of self than Python. Any and every object can be "self", whether the code is in a function or not. So the Python tradition of using the variable named "self" does not fit in Prothon. The next section shows how an object becomes the "self". For now just imagine that somehow there is always one special "self" object at any one time.
Prothon code needs a way to differentiate between local variables, attributes in the self our code is running on, and global variables (in Prothon, globals are attributes of the module running our code). Prothon is introducing a relatively new concept in order to make it very easy to know which of these three types of variable you are referring to. This is the use of character case. Just as Python pioneered the use of white-space (indentation) to control syntax, Prothon is using case to control syntax.
Local variables always start with a lower-case letter or underbar ( _ ). Global variables always start with an upper-case letter. Attributes in the self object are prefixed by a period ( . ), but the name of the attribute itself can start with any case.
def
Of course we need more programming languages. That is how we learn how to make programming languages better.
Sure, only a small number of languages become popular in the end. But that doesn't mean the unpopular ones don't have academic value.
Cheers.
There are sooo many general programming languages but only one database access languages: SQL? SQL is so old, it hurts. It's basically COBOL.
Ok, there is one additional database access language I know of: NewSQL (http://newsql.sf.net).
But it seems nobody is really interested in database access. And everybody is interested in all kinds of general programming language. Why is that?
Why a new language?
Python is a interpreted language with object-oriented features that is practical, powerful, and fun to program at the same time. Over time capabilities have been added to the core Python language, while compatibility with earlier versions has been maintained, and Python has became loaded with features, some quite complex. The metaclass is an example of a recent feature addition. Even Python experts admit that metaclasses are brain-achingly complex.
Prothon is a fresh new language that gets rid of classes altogether in the same way that Self does and regains the original practical and fun sensibility of Python. This major improvement plus many minor ones make for a clean new revolutionary break in language development. Prothon is quite simple and yet offers the power of Python and Self.
Prothon is also an industrial-strength alternative to Python and Self. Prothon uses native threads and a 64-bit architecture to maximize performance in applications such as multiple-cpu hosting.
What is Prothon like?
See a quick description of the Prothon language.
Take a look under the hood at how Prothon is implemented.
Summary of differences from Python.
Development status?
As of 3/04 Prothon exists as a pre-alpha interpreter with minimum capabilites, just enough to try out the language.
Summary of currently implemented functions. Known problems.
Tested platforms: i386-linux, , sparc-linux, sparc64-linux, i386-Win2K, i386-XP, Dual-Opteron-Win2K
Target Schedule:
7/04: Freeze core language specs (keywords, etc.)
10/04: Release version 0.1
Download
Stable (build 115) Source tarball (175 KB)
Stable (build 115) Windows executable zip file (400 KB)
Latest (probably broken) SVN access: svn://svn.prothon.org/prothon/trunk
Latest source view and tarball: http://www.prothon.org/viewcvs/trunk
How can I contribute?
(Mailing list)
For now, the biggest contribution you can make would be adding to the discussion of 0.1 features. Please join the mailing list. Of course helping with the coding effort is always welcome.
Credits
Language design & win32 coding: Mark Hahn
Linux/Unix coding: Ben Collins
newborn-infant-strength...
All Your Memory Are Belong To Java
So, when can we expect Prothon.NET?
Me, I can't wait for Intercal.NET and Brainfuck.NET
The perfect sig is a lot like silence, only louder
I wasn't aware Python was broken.
Nor I... if one wants to create a new scripting language to overcome perceived weaknesses, why make it look 99% like something else that is already out there? Now if the goal were to be object oriented, extensible with C (or Perl or {insert your favorite language here}) modules, free of "brain-aching" complexity, easy to learn and fun to use, skip the Python syntax and make something with clearer scope termination, like say, a *proper* form of VB Script...
http://www.iolanguage.com/
-... ---
Found a little example code inside the tarball, that shows what they mean by no classes:
.name = ""
.__init__(name): .name = name .hello() .
.hello(): .name
Emp_proto = Object()
with Emp_proto:
def
return
def
print "My name is:",
Emp_proto.hello()
emp = Emp_proto("Jim")
emp.hello()
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
Bottom line, someone wanted Python with prototypes. I'm not sure that prototyping -- creating objects from other existing objects by copying, essentially making inheritance a "first class" consideration -- is an analogy that's going to truly redefine the way I look at programming. Or let me put it this way, I'm not at all sure that the benefits of prototyping are going to make me want to restructure -- yet again -- everything I know about programming so far. I mean, after a certain point, programming is a job and I have to produce, not just theorize all the time about new approaches.
Also, judging from Sun's tutorial on Self, it doesn't seem ready for primetime, so I'd be a little edgy about "Prothon".
Prothon. God.
I dunno. This may seem curmudgeonly, but it is, after all, yet ANOTHER language ... Sigh.
Chr0m0Dr0m!C
I'm a bit of a 'language lawyer', so new languages that try to solve problems in interesting ways always interests me. So... I decided to give it a good reading. I got turned off IMMEDIATELY as I saw the following text:
;) )
"Unlike python, there is no 'global' keyword. Any variable name starting with a capital letter is global."
(Taken from memory... the prothon site is a bit slow at the moment, for some odd reason
That is NOT the sign of an 'industrial strength' language.
Yeah, it's a lot like Self, mixed with Python syntax. Self had a lot of interesting ideas. It never really got out of the starting blocks, but some of its most important ideas in dynamic compilation went on to be included in the Java hotspot compiler.
Personally, I prefer a bit more bondage-and-discipline in my languages. That's because I like having the compiler tell me what I'm doing wrong as much as possible. It's a side effect of the environments in which I tend to work, with multiple people working on the same code. Strong typing is an important contract in such an environment. But it has a lot of downsides, as every perl and python programmer knows.
Oh, and dude, if you're going to submit your own damn web site to Slashdot, try getting a sturdier web server first.
What does Prothon do that Lisp doesn't?
Come to think of it, what does *anything* do that Lisp doesn't, except have larger market penetration?
Until all the development of new programming languages stops, I'm sticking to punch cards.
Absolutely revolutionary!
And every time they come up with a new way to factor code it is pointed out that Scheme already supports that methodology without any language changes.
Sure it may be possible to create a language that supports *A* paradigm in an easier-to-learn/easier-to-read way than Scheme, but so far there is none that supports every paradigm and every paradigm that is yet to be thought of like Scheme. People need to give up their lame static typing and just use Scheme. Imagine the time saved not having to learn 900 different languages for 900 different styles of programming when you could just learn Scheme.
Eat at Joe's.
(Yes, I know others have said things similar to this, I just think this is more clear; I read all the comments before the site came up and this juxtaposition still struck me.)
Is it dynamic (can I define functions at runtime)? Is it compiled? Can I easily write code that manipulates code? Are functions first class objects? Can I extend the language seamlessly?
Some new languages are interesting, but most are built by people who have used and understood far too few of the current ones.
Everybody's a libertarian 'till their neighbour's becomes a crack house.
In terms of getting data into and out of a database, how is sql in any way inadequate? The ONLY thing I can think of off the top of my head that I would love to see in SQL that is not currently there is the ability to use regular expressions in a WHERE clause...
Any language that uses whitespace or backslashes for line continuation is madness. This 2004 people. Write a damn compiler that can do the thinking, don't make me screw around with formatting to get my program working. Moronic. Stupid.
http://chicagodave.wordpress.com
From Slate website:
Slate is a prototype-based object-oriented programming language based on Self, CLOS, and Smalltalk. Slate syntax is intended to be as familiar as possible to a Smalltalker...
It also features optional type declaration. The compiler is currently based on Common Lisp.
---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
Personally, I am a nice apricot color, but in the summer I am a more walnut with rose overtones.
Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
...because Python ALREADY has a proto-style object model in its underlying semantics. What's new that Prothon is adding.
:) but it sure wasn't a language theorist, that's for sure! Yuck.
A proto model doesn't distinguish between classes and instances. Everything is an object. Inheritance is done by an object pointing to another object as its "prototype". Basically that means "if you can't find what you're looking for here, go look there". Proto model advantages: much cleaner than class models, much more dynamic, and MUCH more space compact. The most famous two proto languages are Javascript and NewtonScript. NewtonScript in particular is an elegant language that compiles to *very* small memory footprints. The disadvantage: since you have to wander up the proto chain to find what you're looking for, proto languages are slow. The other disadvantage: no strong typing.
Python's bizarre. The underlying model is a proto model. But on top of it, Python hacked a class-based model with pseudo-"instances" (not really, just leaves in the proto tree). As a result, Python doesn't have the clean model design of a proto model, and it doesn't have the speed or typing of a class model. Python's model is quite literally the worst of both worlds.
I dunno who designed Python's model (okay, I know who
Those of us who are unfamiliar with these {dynamic | scripting | kiddie | hack| toy} languages but curious about the classless way of working are not really helped by this document.
If you go to Suns Java site, they don't say "If you are not familiar with C++/Smalltalk, you might as well fuck off."
Similarly Microsofts site for C# doesn't say "Go learn Java, and then find out about GOTO, and you might have a prayer of understanding this."
A good intro with no dependencies will help build momentum for your project.
${YEAR+1} is going to be the year of Linux on the desktop!
The good parts are the implementation: multiple interpreters (no globals), stackless, gc running in separate thread and generally a clean implementation from scratch.
The bad part is from a language design point of view it's a hodge-podge of small yet significant changes from Python, almost none of them, IMHO, an improvement over Python. Those that may be considered a slight improvement are hardly worth breaking compatibility for.
Significant case? Another type of comment? for i in 7 ? a differnt keyword to define generators? Return self by default? removal of class statements for javascript-like object orientation? WTF?
The Python implementation could definitely use an overhaul. The language itself has a few minor warts but strikes a fantastically well-balanced sweet spot that will be difficult to beat. I just can't see the real justification for these changes other than "because I can".
Stop worrying about the risks of nuclear power and start worrying about the risks of not using nuclear power.
I wonder if the twist on being prototype based will catch on in the script world.
It already has. Javascript is also prototype-based.
Yeah , thats legal. The problem is with the code_t definition , not the [].
well sorta I guess. An analogy would be if a carpenter claimed to know how to use all tools of the trade yet never actually builds anything.
I dunno, I take this from experience. At school many of my friends put on their resumes that they can "code" in C, C++, Perl, Java, Javascript, PHP, etc. yet haven't accomplished a single thing in any of them outside of the usual lab assignment.
While new programming languages aren't always a bad thing they have to serve purpose. Perl in my books is cool because it's a fast and expressive language that has handy string/hash/array ops. But langs like Java/C++ really are just a dime-a-dozen. Might as well stick with C for compiled languages...
Tom
Someday, I'll have a real sig.
You can easily get around it with "IMPLICIT NONE," though that might be a DEC extension. I worked so long on a VAX that I can't tell you what is a DEC extension anymore without looking it up.
Errr , have you ever use EITHER language?? SQL is a declarative set driven language and works in a COMPLETELY
different way to COBOL which is procedural. I think you need to go back and re-take compsci 101!
>The truth is that C/C++/C#/Java/VB/Perl/PHP are the most used.[...]>It has been like this for years.
Is that in itselve a good reason not to care about new stuff at the horizon? 'Guess not, but Without a backing of a huge corporation or a huge number of people, no new language would be used. OK. So which companies initially backed Perl, C++, PHP? None. And there were never a huge number of people waiting to volunteer on building a huge code base for these things (and not for others).
They became popular due to huge numbers of individuals that got over their childish "Who cares?" and judged after taking a good look. You should too. Then tell us about why this thing suck or is just not more of an improvement over existing stuff as is C# over Java.
Then again, better, smaller, faster, is no match for cheaper, more accessible, and well-marketed
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
You don't seem to understand exactely what SQL is and your comparison to COBOL is not apt.
First of all, SQL is a declaritive language not at all similar to an imperitive language such as COBOL. SQL is based on a formal query language called Relational Calculus, itself is a subset of predicate logic. The point here is that SQL is based on definded mathematical properties that are then underpinings of relational databases.
SQL is also not just a language for issuing queries, it is also used to define database schema. In this vein its theorectical underpinings allow for the application of normalization theory (or decomposition theory if you prefer) to allow schema to be analysed for redundancies (which can have huge performance impacts).
Check out a book on Database and Transaction theory if you want a better grasp of what goes on under the hood of RDBMSs.
As for NewSQL, I have never seen something so braindamaged (OK, I have. But it's been atleast a week). It basically throws away a significant portion of the power and elegance of SQL to create a query language that looks at best to be a hacked up version of the JDBC API. But even then they are still 'brainstorming' syntax; the project is nothing better than a half-formed thought. Not to mention the serious flaws in the arguments they put forward in their reasons for 'creating' a new database query language which are not even worth wasting the time to refute.
One thing that annoys me about Python-like languages that this new language seems to keep is the reliance on space-count indentation. If you switch editors or share a lot of code, then spaces mixed with tabs can cause a lot of confusion because there is no standard interpretation for how many spaces a tab is.
I agree that it makes the code smaller, but at the risk of code sharing problems.
Table-ized A.I.
Just in case no one else noticed this, figured I would point it out. The parent points out that thy are unfamiliar with the two languages and also evaluates them as {their list here} languages.
2 points for ignorance!
Whee signature.
Smalltalk uses and enforces this convention, and Smalltalk is an industrial strength language. This convention is really effective, makes sense, is consistent and intuitive. You should improve your culture before bashing gratuitously.
BTW right now we're all using a software that embeds a prototype-based object oriented language: JavaScript. If you want to grab the concept I suggest you give it a try (note that I'm talking about the language, which is fine, not about the library or the implementations, which mostly suck). That makes JavaScript, a prototype-based language, the most widely deployed scripting language in the world.
Everybody nowadays seem to think that classes are mandatory in a OO language. Nothing can be farther from the truth.
Don't learn about it from your officemate, or your college instructor, especially if they say they haven't used it in over ten years. You wouldn't believe the opinions of someone who learned C from K&R without upgrading their knowledge, would you?
Instead, start from places like the ALU web site or Cliki or Paul Graham's Lisp FAQ.
If you do this right, you will learn that computer languages:
are not inherently fast or slow - implementations are fast or slow, not languages
can be both dynamic and have good performance
can be cross-platform without swallowing POSIX whole
can have multiple inheritance without damaging your brain
can be object-oriented without being object-obsessed
If you like, you can quit as soon as you understand how static scoping and closures work - at least that way you will avoid the primary mistake in pretty much every recent scripting language.
There is a small risk you will become a SmugLispWeenie by doing this, so be forwarned.
To a Lisp hacker, XML is S-expressions in drag.
I've been paid (as in, it was part of my job at the time) to write code in: APL, Assembler, Basic, C, C++, Cobol, Fortran, Java, JavaScript, Pascal, Perl, PHP, PL/I, PostScript and SQL (plus variants of some of those), as well as job control languages like JCL and WFL, simple scripting in sh and csh, several proprietary application-specific scripting languages like MITS, SPSS, GML and GSL, and miscellanous markup languages (troff, formal, HTML, XML, rtf, etc). And a half-dozen different text editors (CANDE, Teco, FIX, vi, emacs...)
I've probably left a few out, and that's not even mentioning languages I learned incidental to a class assignment (GPSS, Simscript II and Simula for a course on discrete event digital simulation, SNOBOL for something on text processing, Lisp).
The point is not to brag, but to point out that any professional software developer should be both expected to know several languages and should expect to learn and use several more over the course of his career. (But if you're going to mention it on a resume, give some indication of skill level -- expert, experienced or just "I wrote a 'hello world' in it once"?)
A mechanic is expected to have a pretty complete toolkit, with both metric and imperial wrenches, slot and Phillips and Torx screwdrivers, etc. -- and in Canada, Robertson screwdrivers too. (OTOH, he probably doesn't need a left-handed blivet impeller unless he's just into collecting tools for their own sake.) Somebody designing a product to be built -- whether a machine or a software system -- needs to be aware of what tools and materials are available to build the product with, and to maintain it. (In this regard progamming languages are more like materials than tools, either way they should be chosen for their properties.)
-- Alastair
Lisp? Are you joking? Why would I use anything so needlessly complex?! You know, all any programmer really needs is a Turing machine.
/ducks a giant flying lambda
What does any language have above Lisp? Easier to read, easier to understand, faster to code in. Lisp is a language for masochists who don't believe in variables. There! I've said it!
Time is an illusion. Lunchtime doubly so. --Ford Prefect
Getting new syntax into Python is tough. You have to write a PEP and submit it to the newsgroup where it will get picked on, critiqued, slandered, and trashed. Then, if it survives, months later it may get voted on, and given Guido van Rossum's official stamp of approval. And Guido is very hard to please! Given the nature of the changes in Prothon, it would have taken years to agree on anything. In most cases, this is a good thing because it keeps the language stable as opposed to changing every month.
Forking your own branch means you can do what you want. And I have a feeling Prothon's features wouldn't have made it into Python. IMHO.
Time is an illusion. Lunchtime doubly so. --Ford Prefect
I do a lot in VB and that is not because I like the language, but because it has such a good IDE (read intellisense). If I had to program VB in Notepad /Emacs/ whatever, I would slow down by at least 50%, probably 75. You can never convince me that this new language will deliver a better productivity gain then designing a Python IDE which knows all your classes and does auto-complete.
10 ?"Hello World" life was simple then
We already have perfectly good prototype-based programming in Python. Do a search for "metaclass programming in python" for links to my articles on this topic. You can do -everything- with Python metaclasses (which isn't to say you -should-).
But actually, prototype programming is even simpler:
new = old.__class__(init, args, here)
Just what 'old' is is determined at runtime. And if you like, you can poke around at 'obj.__bases__' to futz with inheritence.
Not having read my _Charming Python_ articles isn't really a sufficient reason to create a new programming language.
Buy Text Processing in Python
Having examined this language in some detail, I'm a little disappointed by its design.
1. It makes overly heavy use of punctuation. I'm of the opinion that languages need to be more human-readable, not less. Put another way, the speed and power of coding in any language is not gated by the number of characters it takes to type out a statement; it's gated by the time it takes to find and detect bugs and flaws. Words > punctuation for readability.
2. Many of the design decisions are obviously influenced by one person's peeves with existing languages. The world already has one Larry Wall, and as wonderful as he is, we don't really more Larrys.
3. Elegance is a hard thing to measure, much less quantify. Still, aside from simply being a unique language, it doesn't really offer any new elegance to the concept of what a language should do.
It's an impressive hack, to be sure. I'd be proud to be able to show off a body of code like this, for its demonstration of sheer technical strength. But I find its artistic merits somewhat lacking for my own tastes.
Derogatory or condescending salutation. Quasi-religious statement of love for Lisp.
Laundry list of several nifty Lisp features. (It doesn't really matter which ones.)
Implication or outright statement that every feature in programming language in question has already been implemented in Lisp. Subsequent dismissal of language in question.
Remember, in writing your post, it is essential that you adhere to the following guidelines:
(Disclaimer: I like Lisp. Actually, I love Lisp. It really, truly is incredibly awesome. It's just Lisp users that drive me crazy.)
<ducks REALLY low>
This might be the first time I've seen a product described simultaneously as "industrial strength" and "pre-alpha".
- First they ignore you, then they laugh at you, then ???, then profit.
Prothon is a new industrial-strength, interpreted, prototype-based, object-oriented language
They want their new economy bullshit buzzword generator back.
Da Blog
If you want a nice, clean, prototype-based OO scripting language, check out Lua. Its implementation is mature, it is widely used (a favorite among game developers), and it compiles into compact executables. It also has one of the fastest scripting language interpreters around (short of a JIT). And there are excellent tools for binding C and C++ code to it.
Just a couple of days ago I found out about a cool metaclass hack to turn Python (the regular Python with the regular interpreter) into a metaclass based language. I posted about it on my Advogato journal. I mention this because I think it's pretty cool, and because I think people should see the alternative before thinking Phython is the only way to do this. That's not to say the new language isn't also a good choice.
It is already possible to do prototype-based programming in Python. Also in Perl. But the syntax may be a little awkward.
-- Ed Avis ed@membled.com