Saturday, January 29, 2005

Objects and BASIC?

As an implementor of a BASIC language (http://www.libertybasic.com/) I have a lot of people write me with their suggestions. This is a great thing. Some people ask for object oriented features. I know this is all the rage, and I understand object oriented programming well because I've been programming in Smalltalk since 1988, and Java for 3 years. Smalltalk is the first modern object oriented language, and a darn good one.

Here's the problem. BASIC was not conceived as an object oriented language. Just as many implementors of contemporary BASICs have made the language unrecognizable by piling the features of C and other languages on top of it, an object oriented BASIC risks becoming some other language entirely.

Any really good object oriented language is objects all the way down. In these languages (Smalltalk and Self for example) even numbers, strings, and boolean values are objects. Everything is treated uniformly. It would be a supreme challenge to redesign BASIC so that it had this kind of uniformity. It just wouldn't look like BASIC anymore. :-(

This doesn't mean that BASIC couldn't be extended to have some object oriented ideas. To do so it would be important to identify what the simplest and most useful ideas of objects are, and to invent a very small syntax extension for the BASIC language to support these ideas. I think any object oriented extensions should be simple and consistent enough to be learnable in five minutes. The goal should be maximum bang for minimum buck. Otherwise, why bother when there are already so many other object oriented languages?

2 comments:

Crypto-Man said...

I love using Liberty Basic and everyday I am making more and more advanced solutions from smartcards to crypto.

I was wondering about two things:

1) When I get LB to crash in my experimentation with new code, sometimes I see "SmallTalk/V" windows. I think there is some SmallTalk history behind LB. What is this story ?

2) I noticed by chance an undocumented feature in LB: capability of doing very-long integer arithmetic. This is a nice feature but how come it is never mentioned anywhere ? It is great for implementing crypto application like RSA for training purposes as it is not fast enough. How about putting some essential missing functions like MOD function, and a set of MODULAR arithmetic functions, and bit manipulation functions like ShiftLeft, ShiftRight, etc.

I get my job done by extending unavilable functions by C DLLs but I have to say, it is amazing and very enjoyable piece of work. I can do amazing things with it.

Rogue said...

a very nice idea, PHP has the option to use a OOP style. Is that the basis for your improvements? personally, if you can create it, i'd use java as a base with the upcomeing third basic flavor and its rumored Linux/Mac ports. it would be very interesting.

-- Rogue
Excelsior!!