If you had the time and inclination to create a programming language, what characteristics would it have? [closed]
Just curious. If you had the开发者_如何学JAVA time and inclination to create a programming language, what characteristics would it have?
One language I would like to see would borrow as much from the syntax of Python as possible but compile to machine code that runs as fast as C or C++.
I would limit my language to one statement:
Solve my problem.
Maybe i'd add one modifier though, in case its urgent:
Solve my problem, please.
A mix of COBOL and XML, for the lulz
<program>
<data>
<const>
<name>myStr</name>
<value><[CDATA[Hello, World!]]></value>
</const>
</data>
<sub>
<name>main</name>
<params />
<return />
<code>
<call>
<name>writeline</name>
<params>
<var>myStr</var>
</params>
<giving />
</call>
</code>
</sub>
<meta>
<entrypoint>main</entrypoint>
</meta>
</program>
Programmer would be able to explicitly set the types of vars. And of the arguments in a cool way, like
(string str, array(int)|int someint_or_more, any some_strange_argument)
something like this :)
Programmer would be able to use lambdas, closures, etc at least as in JS
- It would have protytipes-based OOP (like in JS)
- Blocks (if { ... }, etc) would act like a closures!
- It would have a special keyword to define a function which return constant value (if arguments haven't been changed) so It can be cached by compiler/interpreter without any programmers thought about it. It would be very useful, you would be able to use recursion for almost anything and don't really suck with perfomance!
It should be fast and lightweight (not like the .NET Framework), but you should still be able to create fully functional and flexible GUI apps.
A simple block for defining things that can run in parallel, so if I write:
parallel{
do_x();
do_y();
}
something_else();
do_x() and do_y() would be executed in parallel, but something_else() would only be run after both of them complete.
精彩评论