That is not exactly selling the language.
Saw that, closed the page.
That is not exactly selling the language.
Saw that, closed the page.
[]{
Already, the syntax is starting to look a little strange, but OK, I'll give it a shot. id = [int\];
Hm. Backslash seems to be used for something other than escaping. Not a good sign. =;
Huh? The equals operator is being used alone, with nothing on either side? That's really stretching the bounds of convention. -> --> <-> <-
We have various types of arrows that are used as syntax. In some cases, they're used as binary operators, in some cases as unary. Doubling up of dashes appears to change the meaning. This is really not looking good.And then there's the example you mention. Besides how it looks; their example of solving a useful concurrency problem is "a bug-free, efficiently multithreaded real-time clock + infix calculator hybrid application"? Why would you even want that?
There may be something interesting here, but between their quite bizarre syntax and poorly chosen examples, they aren't doing a very good job of hooking me.
From the tutorial[1]:
In ANI, \ means "latch". Basically, a latch is a place where you can "hold on to" an object of the specified type. A latch is like a box that you can put things in to, take things out of, and peek at what's inside.
Forward slashes are for prefixes, backward slashes are for postfixes. Nice parallel there :)
At the very least, people should approach new languages from an ease of typing angle. I look at that and all I can think is "That would be a bitch to type out. Doing it all day? No thank you."
One part of me says "Don't reinvent the wheel", but the other part of me suspects that forcing a new language to follow the syntactical conventions of another language that was designed with different considerations in mind is a bad idea.
The best example of a language that I think suffers from it's association with the syntax of another is C++. The features that it provides are all more or less fine, but cramming it into a syntax that was made for a much simpler language really wasn't a good idea.
(I understand why it was done from a historical perspective, and understand the few benefits it affords, but I think those are particular to that example)
On the other hand again, there really isn't a lack of syntaxes these days that a new language developer can look to for inspiration. Surely one of them should work fine most of the time.
(I'm also German and switched to American Dvorak earlier. I only heard about Neo later, and am too lazy to switch now.)
(Plus since I don't type much German, I don't need quick access to üöäß, though an English-centric variant of Neo would be.. interesting, maybe using those keys for the most common programming symbols?)
* C -- line-continuations (important for macros).
* Perl -- regex back-references.
* Haskell -- anonymous functions.
* Python -- line continuation.
* Tcl -- line continuation.
* Icon -- non-null test (unary), generator limitation (binary).
* Prolog -- \+ for not provable.
* J -- the prefix adverb and the grade-down verb (\:).
* TeX -- Yes.Thus: /\b(\w+)\W+\1\b/ means "match repeated word".
And: /\b(\w+)\W+$1\b/ means "match word preceeded by the word matched on your last match.
Moving on: s/Hello (\w+)/Goodbye $!/ means "Replace Hello followed by a word with Goodbye followed by the same word."
And finally: s/Hello (\w+)/Goodbye \1/ is special cased to mean the same thing, but is frowned upon.
I posit that line continuations don't count, at least not in the "rely heavily" category.
Then I am not sure how popular J and Icon are. So let' keep those away. Is the backlash really used that often in Prolog? I wouldn't say "heavily". So that leaves us with:
* Perl
* Haskell
* Tex
I think that's a more realistic "rely heavily" category.edit: oh yeah.
$\ - The output record separator for the print operator. If defined, this value is printed after the last of print's arguments. Default is undef.
S-expressions?
NB I once got paid to write Lisp, C and PostScript on the same project, if nothing else it taught me to be somewhat flexible about language syntax.
Anyway, to answer in the affirmative: Certain paradigms provide from certain syntax. E.g. Haskell would be much clunkier to write in a C-like syntax than with the ML-derived one it has. And Lisp's macros would be harder to pull off with a different syntax. In my opinion, Python also profits from syntactic differences with C.
Somebody more knowledgeable could talk about SQL-syntax.
> At the very least, people should approach new languages from an ease of typing angle. I look at that and all I can think is "That would be a bitch to type out. Doing it all day? No thank you."
Old languages would also benefit from that approach. We've seen some alternative syntaxes JavaScript, but not really for something like C.
ANI is a very different language to C. Using a C-like syntax wouldn't make sense.
C's syntax is a fairly low level, which makes it fairly easy to map to assembly, but not very well suited for representing high level constructs (see C++).
Note: This is production code.
I imagine searching for Z, R and O in a large code repository.
// remove more clutter
#define O printf
#define R return
#define Z static
#define P(x,y) {if(x)R(y);}
#define U(x) P(!(x),0)
#define SW switch
#define CS(n,x) case n:x;break;
#define CD default
Thanks for that. The comment makes it classic.:)
http://code.google.com/p/anic/wiki/Tutorial
I thought the idea of Streams was interesting and appreciate OP for posting this.
This is a free creation by someone out there who gave their time to do something harmless, useful and freely shared.
But unfortunate part of sharing is also receiving criticism.
Sometimes criticism is stronger when the initial expectation is higher. I think most clicking that link got excited about all the features they read before then they got disappointed when they saw that piece of code.
So his job is not to babysit other techies, i.e. he doesn't care about how others see this project, so then he wouldn't mind the criticism either, right?
I'm not saying this language does a good job at that, but to dismiss something interesting just because of syntax prejudice is shortsighted.
Mostly, when I come across complex equations in CS papers, I tend to skip over them and only go back to look at them if there are parts of the paper I can't make sense of without them - it is very rare to find that they are necessary at all.
The cases where I find I need them are usually a sign of trouble - it tends to mean there'll be a lot of guesswork to figure out parameters and parts of the algorithms that are not spelled out in the paper at all. But usually the same ideas will be expressed in English, code or pseudo-code in much simpler ways.
My research for my MSc involved a bunch of papers on error correction in OCR, including a ton of image processing and statistical analysis, and not one of the 50+ papers I reviewed actually depended on the equations present in them for understanding the ideas, but I quickly learned to appreciate the ones that were light of equations for the seemingly substantially higher odds that the algorithm descriptions would be pretty much complete and precise.
But without such obfuscation, how would CS PhDs retain their competitive advantages?
I mean, if anyone could just read your paper and actually implement the algorithms that you talk about there without having access to your base code and the real details that you didn't publish, then they might scoop you on the next (quite obvious) iterative improvement to your algorithm without having to do two years of preliminary work. And then you'd only get one paper out of it, whereas by obfuscating the hell out of the thing, you can milk it for five or six.
Obviously any equation can be expressed in words, but those who are familiar with the notation are able to read the equations and understand the ideas in a paper in a fraction of the time. This is important for those who read papers regularly.
It is like showing obfuscated C to someone you are trying to convince to look at C
I think some of the language's concepts are pretty neat and unusual.
I just highlighted that the choice to present the most obfuscated and hard to read (and by number of upvotes it seems that most agree) piece of code on the front page of the language is not helping appeal to that second (subjective) part it drives people away before they even get to click on the the tutorial (which explains what is what).
Uncomfortable syntax can be excusable if you have a clear rationale for it, but I can't for the life of me see why this syntax would need to be this awkward.
At this point I shudder at the thought of having to maintain any of that code. I'd even prefer to work on the C I was writing in high school.
What I don't understand is that writing a stream that unlatches a "variable" (a thing bound to a latch) executes once per time the variable is set, but it's not clear why the same code bound to a constant doesn't loop infinitely.
i.e.
i = [int\] <- 10; \i -> std.out;
executes once because i was set once.
i = [int\] <- 10; i -> std.out;
executes once because...
God forbid we should need to learn any new syntax or shudder concepts! The old ways are the best ways.
If the example code doesn't look INSTANTLY, IMMEDIATELY awesome and amazing, it isn't worth a second glance. Even the first glance was a horrible waste of time!
If I read that wrong though, then my apologies.
That said...
I feel like this streaming syntax might be better suited as a meta-programming framework of sorts...build the more intricate objects/modules in a language such as C/C++ or java, and use these stream/latch metaphors to orchestrate those modules.
Yes, you can already do this with *sh (largely the point of Unix pipes), or directly in C/C++/Java (e.g. Storm), but ANI seems to provide a really rich interface for this kind of orchestration. It has many of the right primitives.
I think that is why the criticism is more apparent. It is exciting to have those features, but then the syntax just pushed you away.