7 ms·
That's like saying "Why not just use lisp?" to a python programmer. They're entirely separate languages (albeit it they do share some commonalities, but not as
by feelix 10y ago
That's like saying "Why not just use lisp?" to a python programmer. They're entirely separate languages (albeit it they do share some commonalities, but not as many as you might think).
C is my main language and I dabble in C++. I really dislike C++. I love C. I welcome any efforts to add a bit of higher level functionality to C. I have no desire (ever) to switch to C++.
- loeg 10y agoC programmer here. Cello isn't really C. So as long as you're using something that isn't quite C, and you want an object model, I think "why not C++?" is a reasonable question.
- AnimalMuppet 10y agoBut it didn't look to me like Cello was an object model. To me, it felt more like Perl or Python than C++ - more like a dynamic scripting language.
- webkike 10y agoLooks like C to be. Just some macros and function calls.
- khedoros1 10y agoIf someone showed me a sample of the code, out of context, I wouldn't have guessed it was C. Maybe Javascript (with the "var" declarations).
- feelix 10y agoWhy would you say that "Cello isn't really C"?
- orange_fritter 10y agoIt's arguable that extensive use of macros and faux-dynamic-typing violate the ideology of C that makes it simple and predictable.
- catnaroek 10y agoI'd remove the “faux”. Cello is dynamically typed.
- chme 10y agoThen you could say that just using void-pointers in C that C is also dynamically typed.
- catnaroek 10y agoNot void pointers per se, but if you use runtime information to determine how to interpret the data pointed by a void pointer, that's dynamic typing, yes.
- loeg 10y agoIn C you would only use void pointers very occasionally, to work around the lack of generics/templates in data structures. Most of the time, objects have types. In Cello, everything is a void pointer. Limited as it is, compiler type checking in C is still valuable.
- catnaroek 10y agoStatic typing gives types to expressions (in the program text), not to objects (at runtime).
- loeg 10y agoI'm not sure what you mean by objects at runtime. Can you elaborate? The sort of objects I interact with at runtime are typically typed structures, so I guess I don't understand your statement.
- spott 10y agoWhat do you love about C and hate about C++?
- chriswarbo 10y agoI'm not the parent, but C has a certain simple elegance: everything's an int; those things which aren't ints (e.g. compound structures like structs and arrays) are represented using pointers and offsets, so in a sense they're also ints; except for floats, but meh. In C++, everything is an int; except for objects; and templates; and lambdas; and classes; and exceptions; and all the other things which keep getting chucked on to the pile. I like languages with a clear, simple concept behind their operation: lambda calculus, combinatory logic, Scheme, Forth, Joy, Pure, etc. C is a bit gnarly, but passable. C++ is horrible.
- louithethrid 10y ago>I like languages with a clear, simple concept behind their operation. So you dont like C because Undefined behaviour complexitys. Im confused now.
- chriswarbo 10y agoAs I said, C is gnarly, mostly for legacy and "practicality" (WorseIsBetter) reasons. Undefined behaviour, declared as in a language standard, isn't too bad; it might forbid some potentially-useful combinations of expressions, but there'll usually be a workaround. The problem is compilers which allow undefined behaviour by default, rather than aborting with a helpful error message. This puts the burden of avoiding undefined behaviour on the programmer, which is really bad. This might be unsolvable for C, due to the nature of its particular undefined behaviour. For brand new languages, I'd recommend minimising undefined behaviour as much as possible, but definitely ensure that any that remains can be found statically!
- metaobject 10y ago"everything's an int" I don't understand this. Floating point values aren't ints. I suppose strings are integers because they're made up of 8-bit chars (which are basically ints), but I don't understand how that is advantageous or helpful.
- faragon 10y agoFor "pure C" with high level string and dynamic memory handling (with data types in both heap and stack), consider checking https://github.com/faragon/libsrt https://github.com/faragon/libsrt (not production ready for "NASA-like" things, but I've put an important effort in test-coverage, aliasing awareness, etc.) :-)
- kyberias 10y ago> That's like saying "Why not just use lisp?" to a python programmer. They're entirely separate languages That's not really true now is it? Sure, C++ and C are separate languages but they have a common history and everyone knows that. One can write extensive programs that are valid for both C++ and C compilers. C isn't a true subset of C++ but for from many practical perspectives it is. In practice they have a common ancestor language that still can be (more or less) compiled with both compilers. Lisp and Python however... they have no such common ancestor and the syntax are very different.
- geezerjay 10y ago> That's like saying "Why not just use lisp?" to a python programmer. Only if a python programmer was resorting to contrived macros to shoehorn some of Lisp's features onto python. If a python programmer wants to write lisp in python, why not simply use lisp?
- divs1210 10y agoWhy do you think that's not already happening? Have a look at Django ORM. https://github.com/django/django/blob/master/django/db/models/base.py https://github.com/django/django/blob/master/django/db/model...