• Welcome to Valhalla Legends Archive.
 

The Ultimate Programming Language!

Started by Banana fanna fo fanna, January 23, 2005, 09:32 PM

Previous topic - Next topic

Banana fanna fo fanna

Python! No, seriously now, what do you think would comprise the ultimate programming language? I think:

- optional garbage collection which is on by default
- as native as C (none of this VM shit)
- modern language features like packages
- operator overloading with a slew of new operators (like slicing)
- continuations and other LISPy things
- concise, less-typing syntax
- macros
- __maybe__ an intermediate code which can be compiled to native code on various OS's once to generate executabels

I'm asking this because I'm going to write another compiler this semester.

tA-Kane

Disassemblers are more fun to write, let alone a heck of a lot easier, I think.

If you're just writing a compiler, could you not use a language that already exists? Like, write another C compiler?
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

iago

Quote from: Banana fanna fo fanna on January 23, 2005, 09:32 PM
- concise, less-typing syntax
- macros

Those tend to lead to horrible lazy code.  Macros are the root of many evils, and many hard-to-find problems.  As an example:

#define MAX(a,b) (a<b?b:a)

.......
int c = 4, d = 10;
c = MAX(c++, --d);

Because of the macro expansion, that will expand to:
c = (c++<--d?--d:c++)
Which will, of course, return 8 (because --d is run twice), which is a completely unexpected result.

Anyway, that's my argument against Macros.  Take it how you like :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Arta

There's nothing wrong with a thoughtful, well-written macro. That macro is stupid. It ought to be a function.

People rail on about macros being bad, but I think that's crap. Macros are an incredibly useful tool. Like anything, they can cause problems when they're misused.

Adron

"garbage collection" and "native" don't go together...

Kp

Actually, you can make a native program which has a garbage collector.  It's just not necessarily going to run as fast as a GC-free language, since the compiler will need to convert all references to complex types into extra record-keeping code to ensure that the reference count is right so it can be garbage collected on schedule.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Adron

But as native as C? You're supposed to be able to cast between numbers and strings and pointers freely, with no type checking, and insert assembler code virtually arbitrarily.... ;)

iago

Quote from: Arta[vL] on January 24, 2005, 09:48 AM
There's nothing wrong with a thoughtful, well-written macro. That macro is stupid. It ought to be a function.

People rail on about macros being bad, but I think that's crap. Macros are an incredibly useful tool. Like anything, they can cause problems when they're misused.

So any macro that uses a variable more than once is "stupid"?  Any macro that uses a variable more than once will succumb to that problem, unless the programmers using the macro are aware that it's a macro and that it might have that effect.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Kp

Quote from: Adron on January 25, 2005, 01:38 AMBut as native as C? You're supposed to be able to cast between numbers and strings and pointers freely, with no type checking, and insert assembler code virtually arbitrarily.... ;)

I see your point.  From his statement of "as native as C (none of this VM shit)", I took it merely to mean that he wanted processor-native code, as opposed to interpreted bytecode.  It would complexify the language a bit (and introduce extra work for programmers who wanted to do casting), but I still think he could make a machine-native garbage collector.  It'd merely require a convention such as "You must keep a visible reference to an object or it'll go away, even if your inlined assembly still knows about it" for garbage-collected objects.  He already specified that garbage collection would be optional, so arbitrarily crafted pointers would be declared as not-garbage-collected.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Banana fanna fo fanna

I was thinking something along the lines of:


class MyClass extends GarbageCollected {
   ...
}

dxoigmn

Quote from: Banana fanna fo fanna on January 25, 2005, 03:59 PM
I was thinking something along the lines of:


class MyClass extends GarbageCollected {
   ...
}


Then you need to implement multiple inheritance which is icky.

Adron

But if all you're doing is create a class to inherit from to get garbage collection, you might as well use C++ and write a garbage collector for it, or use one of the existing ones ;)

tA-Kane

That wouldn't be a bad idea of garbage collection wasn't a bad idea in the first place.

Nothing like keeping track of your garbage yourself... :P
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

dxoigmn

Quote from: tA-Kane on January 25, 2005, 04:48 PM
That wouldn't be a bad idea of garbage collection wasn't a bad idea in the first place.

Nothing like keeping track of your garbage yourself... :P

Garbage collection is the best.

tA-Kane

Btw, I think having all user variables *not* stored on the stack may be a good idea for a language... especially not arrays...
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com