So let's collect which features are desirable. Which style is to be avoided for what reasons etc.
This is meant to understand which features we care about. Whether such a language is a real choice is another topic.. But let's collect wisdom
Goal: Focus on reusable code, eg think about how to translate to C/C++/Elisp/Haskell so that some code eventually can be shared with other editors if it makes sense.
Haskell also has "state", STM, IO refs and such. So at least it separates concerns.
This problem will always be there, the key is to make it expricit and understandable.
Why code might fail returning a valid result/ reason why Exceptions exist :
What are Exceptions? Well, instead of returning a value, an Exception is returned.
So Exceptions work fine for PHP (you run one HTTP request, either it succeeds or it fails), but except that they only serve the "documentary" purpose: tell what went wrong and where (because many Exceptions tend to have a stack trace and the like)
State is something you look at to know what a system/buffer contains. The bigger a system, the harder it is to define state. Examples are transactional databases (here its somewhat easy), however such "single state" concepts are given up fast if data becomes bigger.
The only "true" solution are pure systems, such as Haskell. Initially they don't have state, they just provide functions taking input and having output. So nothing can go wrong. Then they introduce IO monad which is about getting such input/output from something stateful. (Of course there is more to it STM and such). Thus Haskell separates code operating on data, and state containers.
Possible state implemenations:
which options for what reason?
If choosing C++, what would be nice coding standards?
I used D for a project and I quickly went back to C++. When it works fine it is probably better than C++, but in my experience it is rare. I my opinion all the reason to dislike C++ disappeared with C++11.
- N Paolo Bolzoni
comment: Yzis is written in C++, but maintainers have given up because it got too complicated.
pros / cons http://lambda-the-ultimate.org/node/4338
Thus writing complex pieces of software in short time is not possible IMHO. That you still can get jobs doen is shown by the linux kernel, git, ..
Yes - I know that a lot of code I depend on is written in C (kernel, Vim, gimp, ..).
Try rewriting these two examples in C, and you'll understand:
// RUBY sample code File.open('foo.txt') do |file_handle| file_handle.write(user_input()) end // even if user_input() throws an exception the file handle will be closed
// Haskell/ocaml sample code: // polymorphic function. add :: (Numeric n) => n -> n -> n add = (+) -- use with floats print (add 2.0 4.0) -- use with ints print (add 2 4) -- haskell will compile two versions of add for each type. -- you write the add implementation only once. -- Yes C++ can do so, too. The problem with C++ is that some C programmers -- think its too easy to shoot yourself into the foot using C++ -- example: gnome/gtk/gimp and Vim
The first example is about sane error handling about things like "file cannot be opened" for whatever OS reason. The second example is about having simple maps associating keys and values (such as global lists, mappings, ..)
Zimbu Bram might join when Zimbu would was used. cool language. What it does is great and designed the right way. But Marc Weber wants more features.
MarcWeber: check out the tutorials for constructing interpreters with rpython http://morepypy.blogspot.ch/2011/04/tutorial-part-2-adding-jit.html ...could be quite handy for reimplementing viml. also did you write out your requirements for for the functional language you wanted we were talking about?