Dart Is Not the Language You Think It Is 312
An anonymous reader writes "Seth Ladd has an excellent write-up of Dart: 'When Dart was originally launched, many developers mistook it for some sort of Java clone. In truth, Dart is inspired by a range of languages such as Smalltalk, Strongtalk, Erlang, C#, and JavaScript. Get past the semicolons and curly braces, and you'll see a terse language without ceremony. ... Dart understands that sometimes you just don’t feel like appeasing a ceremonial type checker. Dart’s inclusion of an optional type system means you can use type annotations when you want, or use dynamic when that’s easier. For example, you can explore a new idea without having to first think about type hierarchies. Just experiment and use var for your types. Once the idea is tested and you’re comfortable with the design, you can add type annotations."
Re:There are two kinds of programming languages... (Score:4, Insightful)
Re:There are two kinds of programming languages... (Score:5, Insightful)
I vote for no one cares.
I for one never encountered a situation where I thought "gee, if only I could prototype without types!". Types matter. When solving even the most basic data processing problem there's "input" and "output". Specifications are very clear on the formatting and types. What happens in between is dictated by those types.
Typeless programming in shorthand for lazy markup.
Wish it had better JS interop (Score:4, Insightful)
I fooled around with Dart a few months ago. I like the language. But I really want to be able to use it AND all the javascript libraries that do lots of work for me. It's my opinion that it will be hard for Dart to get traction if all those libraries have to be rewritten.
YASL (Score:2, Insightful)
The proliferation of computer languages (Score:5, Insightful)
I haven't used DART yet, so I will not comment on the strength or the weakness of it
But, all through the decades that I've been in the scene, there have been so many programming languages invented, but so few of them being used
Some of the more widely used programming languages like C, for instance, are not perfect, but they are being used partly because of legacy, partly because of momentum, and partly because of the laziness of programmers to learn new, more useful languages
Talking about legacy, the other day there was a piece on Cobol, and that IBM is trying to extend Cobol to the cloudsphere
As for the languages that are not so-widely used, some of them are downright weird, but then, there are gems among them. The only downside for those few gems is that the ecology is not there to enable those few gems to become more widespread
I guess it's kinda Darwinian game plan --- not all surviving/thriving species are perfect, and not all the extinct species are bad, either
Re:So, like Lisp (Score:4, Insightful)
more restrictions and unnecessary syntax
I like syntax. It helps human beings read code. It was never intended for anything else.
BTW, what language is going to evolve back to Lisp and be usable for writing OS kernels, drivers and other such primitives?
Re:Unadvantages! (Score:5, Insightful)
It lets you throw something together quickly for a proof of concept
the thing about type safety ... even if you use a non-type safe language, you still have to get it right or your crap will crash, or worse, run and do something unexpected. you still need to be type safe, it's just that you have to find all your bugs at runtime in stead of compile time. do we need to discuss why it's better to catch bugs at compile time?
Re:Unadvantages! (Score:4, Insightful)
Unless you like bugs, type-checking is a good thing. Lack of type enforcement encourages what -- lack of forethought?
My thoughts exactly. Any language that makes you believe you can leave the "thinking" to the compiler is the wrong approach.
Might as well program the next Mars rover in PHP.
(not that PHP is bad as such, it just makes lazy programmers more lazy)
As long as it kills Javascript (Score:3, Insightful)
There are problems with new languages (Score:3, Insightful)
One Problem is teaching.
One problem is "compatibility" or "easy to learn". E.G. regarding keywords.
C has a keyword: static.
C++ has the same keyword: static.
As Java aimed to be similar to C++ and "easy to learn" it also has a keyword static.
While the meaning of the "keyword" in Java and C++ is the same, it differs from C. (Oh! and this already is not true as you can use 'static' in C++ similar to C if you just use it for free functions and data).
So what does 'static' mean?
http://dictionary.reference.com/browse/static [reference.com]
http://www.thefreedictionary.com/static [thefreedictionary.com]
http://www.merriam-webster.com/dictionary/static [merriam-webster.com]
http://oxforddictionaries.com/definition/english/static [oxforddictionaries.com]
Unfortunately 'static' in a programming language has no meaning at all. Why is the "starting method" in Java called "static void main(String[] args) {}"? Yeah, because in C and C++ it is called main(). Pascal has not that problem.
What do you think a non native english (oh, well what about the english?) considers if he hears the word 'static'?
Good, now lets bash Python and Groovy. What is a "def"? Oh? A definition? Are you certain you can distinguish what the difference between a definition and a declaration is?
So "methods" are now "declared" (or is it defined?) by the introducing keyword "def"? Oh, for fuck sake, I got it wrong again.
Oki, in Python you declare, oh no!!!! you define methods with the keyword "def". In Groovy you define variables (oh! no!!!!! you declare!!!) with the keyword "def".
Yeah, I could rant forever ...
All new languages we see here and there are only languages for programmers that already can program.
But, what is about expressing your mind?
What about teaching programming? Imho Java is one of the most difficult languages to teach. Why? Because you need to know already so much about programming to grasp it!!!!! (Same for C# ofc).
However: modern times show: you don't need to understand Java/C# (just a replacement for most modern languages) because the programing tasks a modern developer has (especially compared to the tools he has at hand) is so mondane. C++ on the other hand only shows how super smart and knowing you need to be to use the language, or not to shoot into your foot.
So where are we?
New languages should use new keywords, that describe precisely what they mean. No void, no static, no final or for that matter finally, no fucking def, var or func. Did I forget one? I certainly did. And they should have reasonable defaults. I hate Java meanwhile, "public void doit() {}", "private boolean done = false". Then we get to "static final String DID_WE_DO_IT = "yes we did";" What is so hard in having methods be PUBLIC by DEFAULT and attributes PRIVATE by DEFAULT? ... neither C++ nor Java nor C#. The redundancy hurts me literally.
Writing code is still possible, even if it hurts my hands and my eyes. But reading? I simply don't want to read code anymore
In a typical Eclipse window I would estimate 30% of all characters/words are simply superfluous. And the fact that they all have a different colour emphasizes this.
How would a real world language look to you if it was written like this: "I want (that is me the guy writing) that we (that is us, you who are listening, and me who is talking) that we (well, dont be mistaken, I only want it, it is not an order) that we (yes, I invite you to participate) go to the beach (and want does not mean it is super important ... it is kinda void)? (And all words in () above in a different colour? Like pink (ARRRRGGG!!!!) light green ( /*facepalm*/), dark and light blue, emphazised(bold) full
Re:There are two kinds of programming languages... (Score:5, Insightful)
Yeah, exactly. What the writeup calls "appeasing a ceremonial type checker" is more properly called "debugging".
Don't get me wrong, I like the thrill of the chase, the satisfaction of tracking down a really hard bug, as much as anyone. But I like programming even more. Using a well-designed type checker, I can find bugs in my program and convince myself that I'm programming rather than debugging.
Re:There are problems with new languages (Score:4, Insightful)
If you think all those words are superfluous you probably don't have much knowledge of compilers or IDEs. The static keyword has very well defined meaning in every language it is used in. As do all those other keywords you seem to hate. Should we kill modern programming languages and go back to what, a stripped down functional paradigm because you deem all this stuff superfluous and hard to teach to beginners?
Programming is about precision. I should never have to guess at what the compiler is going to do with my code; programming is not a natural language. You are damn right I want a void return type. I want OO static members. I want all the information that can be put into method/function/variable definitions so I can take a quick glance and see what it does, takes and returns. So that my IDE, if I'm using one, can auto-complete most of the code for me. So that the (JIT-)?compiler or interpreter can understand all kinds of fancy syntax that lets me do more and write less.
Those five things you mention have nothing to do with C or C++. They are programming concepts and pretty basic ones at that. Obviously you have to understand the basics before you can move on to intermediate.
Re:There are two kinds of programming languages... (Score:2, Insightful)
Wait a minute. I'm a programmer BECAUSE I'm lazy.
Re:Understanding Dart's goals (Score:4, Insightful)
That sounds like a maintenance nightmare. The code you're writing and debugging is not the code actually running
When you're writing native desktop apps, the code that's actually running is also not the same as what you're writing and debugging - the former is assembly, the latter is C or C++.
Re:The proliferation of computer languages (Score:5, Insightful)
What can't you do in C? Not a hell of a lot, sure - but the level of effort is often not worth it. I've spent 20 years doing development primarily in C, and it's often not the right tool for the job.
Re:Unadvantages! (Score:2, Insightful)
In my experience, there is no such thing as a proof of concept or a prototype or whatever qualifier you have for something that isn't done, unless you only put it in front of other developers.
The moment you put a proof of concept in front of a PHB or other similar, their brain immediatly melts and the only though they can form is "oh look, it's already done!".
Never, ever count on being able to "go back later and _really_ implement it".
Of course, this is only a problem in poorly run organizations. Unfortunately, this in 99% of organizations.
Re: What can't you do in C? (Score:5, Insightful)
Return a list from a function. Sure, you can legally do it, there's nothing in the language inherently stopping you, but experienced C programmers will avoid returning a list at all costs, because suddenly you have to care about whether the caller frees the list properly, and what if the things in the list are used elsewhere and we need to do reference counting etc.. etc... I've worked on a C codebase that was a couple hundred thousand lines of code, and I can't think of anywhere that we ever returned a list from a function. I can't think of any Haskell program more sophisticated than "hello world" that I didn't use "map" and other list functions all the time.
Ultimately, the cost of manual memory allocation isn't just the extra work you have to do to make sure you aren't leaking or corrupting memory, it's the algorithms you won't allow yourself to even consider because the memory management would just be too hard.
I'm not saying C doesn't have it's place, I'm just saying that there are software engineering costs associated with using C as opposed to a higher-level language.
Re:Unadvantages! (Score:4, Insightful)
Nope. Smalltalk died because projects written in it were unmaintainable. Simple as that.
Re: What can't you do in C? (Score:5, Insightful)
Return a list from a function. Sure, you can legally do it, there's nothing in the language inherently stopping you, but experienced C programmers will avoid returning a list at all costs.
Hmm, that's odd. So C has its place but it's avoided because it lacks garbage collection? My C code has automatic garbage collection and OOP facilities. It's got lists and maps, and a comprehensive collections library. It's just under 30 thousand lines of code, but then it's just a game engine. It only has to do everything the computer actually can. If you don't have these basic facilities in your C library, it's your own damn fault. Seems to me if I want I can always have it in C, there's no excuse for not having it.
My memory manager replaces the malloc / free facilities, so it can even be added to other C code-bases, hell, I use it in C++ code because it's faster than the GC in the standard library (for the way I use it). So it's not like I have to call reference counting functions; Just the GC_recycle() function, or enable it to run automatically, which blocks on malloc() / free(), and optionally gives each thread their own local GC rather than a unified approach such that part of the program can garbage collect while another keeps running.
However, when my testers bitch about stutter in Java / Android No matter how badly I want Java or JavaScript to give me control of the damn garbage collector, so it doesn't run in the middle of the rendering loop or intense action sequence, I can't have it. I have to implement an object cache atop Java and pre-allocate everything, try my hardest not to give the GC a chance to run, and if I slip up once and let that fucker have control, it's game over, literally, when the enemy attacks and the game lags for half a second.
I return lists from functions all the time you dumbass. I'm an "experienced C programmer". Stop painting with such a wide brush, you're getting the paint in you eyes.
An AC adds:
Or return a function from a function?
I throw Function pointers around like crazy, that's how efficient state machines, decision trees, or other flexible structures are formed. Hell, my Entity-like system allows Actors to composite sets of functionality as it transitions states to create efficient AI -- Just because it's fleeing doesn't mean it's still not searching for Health. It would be like if C++ let you pick which methods you inherited from multiple parents on the fly. I mean hell, returning and passing a function pointer is how I implemented multiple sorts:
// or
list->sort( list, list->getSortRoutine( SORT_MERGE ) );
myCustomRoutine = getCurrentSort();
list->sort( list, myCustomRoutine );
That first "list" being passed in the sort function pointer invocation is where your magic "this" pointer comes from in C++.