Prototype-based programming

H

Hung Jung Lu

Hi,

Description of PBP (Prototype-based programming) can be found at:
http://en.wikipedia.org/wiki/Prototype_based
http://www.dekorte.com/Proto/Chart.html

("Self" is an example of a PBP language:
http://research.sun.com/self/language.html)

The most naive PBP would imply a overwhelming redundancy in namespace
entries. (E.g: all object instances carry bindings for their methods.)
Efficient in time, but not very efficient in space (memory usage). But
I am sure people have looked at lookup-precedence strategies, much
like how Python finds names first in the local, then the global, then
the built-in namespace, or how instance attributes are looked up in
multiple inheritance.

I got looking into PBP because Python starts to look evil when you use
descriptors, metaclasses, etc. And that's not just Python: the
fundamentals of most well-known languages are getting more and more
complicated. The current programming world reminds me of the situation
of the time when RISC came up against CISC. I mean, it's OK for a lot
of additional features to be built on top of the fundamentals, but
nowadays the fundamentals themselves are getting too complicated. Is
it time to take a break and say: "there is gotta be a simpler way!"?
From the little I read about Haskell it seems that it's possible to
keep the fundamentals clean and do complex things at the same time.
The usage of classes is just weird... it's a concept from the 1970s
and should probably be retired by now. Because you use classes, you
then hit upon metaclasses, (and meta-metaclasses... ad-infinitum), and
also come up with funny "patterns" like Singletons, or define "static"
class attributes. I mean, aren't all these the symptoms that we are
doing something wrong?

regards,

Hung Jung
 
B

Bruno Desthuilliers

Hung said:
Hi,

Description of PBP (Prototype-based programming) can be found at:
http://en.wikipedia.org/wiki/Prototype_based
http://www.dekorte.com/Proto/Chart.html

("Self" is an example of a PBP language:
http://research.sun.com/self/language.html)

The most naive PBP would imply a overwhelming redundancy in namespace
entries. (E.g: all object instances carry bindings for their methods.)
Efficient in time, but not very efficient in space (memory usage). But
I am sure people have looked at lookup-precedence strategies, much
like how Python finds names first in the local, then the global, then
the built-in namespace, or how instance attributes are looked up in
multiple inheritance.

You may want to have a look at Io
http://www.iolanguage.com/

(snip)

Bruno
 
R

Rene Pijlman

Hung Jung Lu:
From the little I read about Haskell it seems that it's possible to
keep the fundamentals clean and do complex things at the same time.

Perhaps it should be the other way around: allow complex fundamentals to
be able to do elegant things :)
The usage of classes is just weird... it's a concept from the 1970s

The wheel is a concept from 4000 BC (http://en.wikipedia.org/wiki/Wheel).

Pardon my ignorance, but what is the next great thing to replace
OO/classes?
 
H

Hung Jung Lu

Bruno Desthuilliers said:
You may want to have a look at Io
http://www.iolanguage.com/

Thanks. That was a good dose of adrenaline shot. :)

It's amazing to see how people are converging. It's also refreshing to
see some brains out there. I am over 1 year late in knowing about the
existence of Io (it came out last year) and over 2 years late in
hitting upon some concepts. But that's all right. Better catch up late
than never. :)

When I saw that Io was prototype-based, I told myself: "OK, smart".
When I saw statements were message-based, I told myself: "OK, more
than smart". When I saw that it was designed with full awareness of
Python and Ruby, I told myself: "OK, very smart". When I saw that it
has codeblocks ("block" in Io syntax) and weaklinks, I told myself:
"OK, really smart". When I saw that it can print the source code of a
block, I told myself: "OK, extremely smart". :)

Of course, all the fundamentals have been out there before. But it is
refreshing to see people heading in the right direction.

regards,

Hung Jung
 
J

John J. Lee

I got looking into PBP because Python starts to look evil when you use
descriptors, metaclasses, etc. And that's not just Python: the
fundamentals of most well-known languages are getting more and more
complicated. The current programming world reminds me of the situation
of the time when RISC came up against CISC. I mean, it's OK for a lot
of additional features to be built on top of the fundamentals, but
nowadays the fundamentals themselves are getting too complicated. Is

In principle, I agree, though I can't say it's ever actually bothered
me in practice with Python.

it time to take a break and say: "there is gotta be a simpler way!"?
[...]

JavaScript (no, don't run away!) is actually quite similar to Python
and is prototype-based.

JavaScript (ECMAScript, now) has a global object (that happens to be
window in web browsers) that functions rather like the global
namespace in other languages.


John
 
M

Michele Simionato

When I saw that it
has codeblocks ("block" in Io syntax) and weaklinks, I told myself:
"OK, really smart". When I saw that it can print the source code of a
block, I told myself: "OK, extremely smart". :)

Why do you want to print out the source code of a block? Are you thinking
about dynamic modification of the source code and recompilation of the
code block on the fly? If you want those features then lisp-like languages
are a natural choice. Or do you have something else in mind ?

Michele
 
H

Hung Jung Lu

(e-mail address removed) (Hung Jung Lu) wrote in message
Why do you want to print out the source code of a block? Are you thinking
about dynamic modification of the source code and recompilation of the
code block on the fly? If you want those features then lisp-like languages
are a natural choice. Or do you have something else in mind ?

The latter. Keeping reference to the source code means that you have
taken into account the needs of debugging/tracing: you can step
through the code, set break points, etc., even if the pieces are
dynamically assembled. Dynamically compiling code is piece of cake,
even C# does that. But have you thought about break points and
debugging issues?

regards,

Hung Jung
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,477
Latest member
ColumbusMa

Latest Threads

Top