473,379 Members | 1,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Prototype-based programming

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
Jul 18 '05 #1
7 1937
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?

--
René Pijlman
Jul 18 '05 #2
Hung Jung Lu wrote:
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

Jul 18 '05 #3
Bruno Desthuilliers <bd***********@removeme.free.fr> wrote in message news:<3f***********************@news.free.fr>...

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
Jul 18 '05 #4
hu********@yahoo.com (Hung Jung Lu) writes:
[...]
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
Jul 18 '05 #5
hu********@yahoo.com (Hung Jung Lu) wrote in message news:<8e**************************@posting.google. com>...
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
Jul 18 '05 #6
mi***************@poste.it (Michele Simionato) wrote in message news:<95**************************@posting.google. com>...
hu********@yahoo.com (Hung Jung Lu) wrote in message news:<8e**************************@posting.google. com>...

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
Jul 18 '05 #7
> 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.


Right you are, John. For example,
http://www.crockford.com/javascript/inheritance.html

Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Florian Loitsch | last post by:
hi, in section 10.1.8 (Arguments Object) it is stated that the "internal ] property of the arguments object is the orginal Object prototype object, the one that is the *initial* value of...
8
by: Elf M. Sternberg | last post by:
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the...
8
by: Robert | last post by:
Hi, I can use "with" like this: function MyObject(message) { this.message = message; } function _MyObject_speak() {
2
by: stephane | last post by:
Hi all, What I am trying to achieve is an 'inherits' method similar to Douglas Crockford's (http://www.crockford.com/javascript/inheritance.html) but that can enable access to the superclass'...
4
by: lkrubner | last post by:
I'm reading an essay, I think one of Crockford's, and it has this example in it: function Demo() { } Demo.prototype = new Ancestor(); Demo.prototype.foo = function () { } ; Does Ancestor now...
21
by: Rob Somers | last post by:
Hey people, I read a good thread on here regarding the reason why we use function prototypes, and it answered most of my questions, but I wanted to double check on a couple of things, as I am...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
6
by: mmcloughlin | last post by:
I'm learning about objects and am trying to figure out how basic inheritance works. I've got into the habit of explicitly setting the prototype object with an object literal as it seems to make the...
5
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
6
by: burningodzilla | last post by:
Hi all - I'm preparing to dive in to more complex application development using javascript, and among other things, I'm having a hard time wrapping my head around an issues regarding "inheritance"...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.