tag:blogger.com,1999:blog-27488238.post7744024490130667031..comments2024-03-22T11:34:45.165+01:00Comments on taw's blog: Syntactic tradeoffs in functional languagestawhttp://www.blogger.com/profile/16972845140253292628noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-27488238.post-75877682305398057522007-06-21T18:25:00.000+02:002007-06-21T18:25:00.000+02:00Of the "limitations" you mentioned, only one is re...Of the "limitations" you mentioned, only one is real, and that's backreferences. The rest are just you not wanting to learn regular expressions. Not co-incidently, backreferences are the reason pcre is so horribly slow. Of course, you didn't use backreferences, and they are very rarely needed. If you really wanted a good grep that has backreferences, you could install one. There are grep implimentations that support backreferences, but still impliment any regexes without backreferences in the smart, effecient way. But hey, just use the lowest common denominator shitty software written by morons who still haven't figured out how to copy 40 year old algorithms, that sounds smart.<BR/><BR/>And while it may be nice to try to dismiss anyone who disagrees with you as a fanboy, it makes you look pretty dumb when you ignore what I've said while you do it. If I thought unix's flaws were sacrosanct, I wouldn't suggest that the modern replacement for unix which fixes many of those flaws is superior would I? I guess the cynics are right, you're not really a troll, you actually are that dumb.<BR/><BR/>Just because *you* think 99% of the time mv should behave like you are an idiot doesn't mean everyone thinks that. 99% of the time *I* want mv to behave just as it does, and the times I don't I use mv -i. I've never seen anyone think otherwise except for linux noobs like yourself. You know, the ones who pretend they know unix, and that unix is so great, but they have't figured out the basics of how to use their shell yet.<BR/><BR/>If want a horrible, bloated shitware OS that pretends to be unix, but ignores every single fundamental aspect of unix, then you should really be looking forward to the hurd so your kernel can suck as badly as your userland. Hopefully it will impliment nagging directly in the filesystem so you have an extra layer of stupid confirmations to protect you from yourself.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-53004512281561745902007-06-19T11:39:00.000+02:002007-06-19T11:39:00.000+02:00Anonymous: Some limitations of grep are not suppor...Anonymous: Some limitations of grep are not supporting character classes like \d and \p{Hiragana}, ()s, backreferences, and all other useful PCRE features. It's not true that GNU grep is always faster - GNU grep used to be painfully slow in UTF-8 mode, something like 10x slower than pcregrep, but they apparently fixed that already.<BR/><BR/>"mv" should mean "move file". Unfortunately Unix is braindead enough to interpret it as "remove whatever was there first and move file". The removing part is intended behaviour in maybe 1% of cases - they you could confirm or use -f. In 99% if something is there it means a mistake was made, and you want to cancel. It's one of the worst cases of Unix brain damage ever - causing severe loss of user data just because the design fuckup is old and Unix fanboys consider all old design fackups sacrosanct.<BR/><BR/>In any case if you want 1980s Unix, you know where to find it. The rest of us moved on since then.tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-32844625035630319542007-06-19T08:39:00.000+02:002007-06-19T08:39:00.000+02:00What limitations of grep? Give an actual example....What limitations of grep? Give an actual example. There is no case where pcregrep is significantly faster than grep, ever. Naive backtracking regex implimentations perform exponentially worse in many situations, and if you've had any serious experience with these bad regex implimentations you would be familiar with the common workarounds you need to use to create equivilent but non-pathalogical patterns so performance doesn't deteriorate exponentially as the input grows. You should actually read that link instead of dismissing it with nonsense like that.<BR/><BR/>cat somefile | some_command is NOT idiomatic unix, its idiotic unix. grep takes a file as its argument. grep 'pattern' file, not cat file| grep 'pattern'. And if something doesn't take a file as an argument, then redirect its stdin: grep 'pattern' < somefile.<BR/><BR/>What do you want your shell to do about the fact that you run commands for no reason? Its not a bug, its doing exactly what you asked it to do. Its not the shell's fault you told it to do something dumb. Unix is very user friendly and easy to learn and use. Just because you don't like the way it works doesn't mean unix needs to change, perhaps you just need to find an OS that suits your desires better. If you want needless questioning when you command (look up the definition of command) the system to do something, then tell it to ask you. mv means move the file. That's what it does. mv -i means move the file but ask me questions first. And that's what it does. 1980's unix isn't bad, its far better than the unfortunate messes that linux distros are. plan9 is even nicer, than unix, but its mouse-centric interface is a real disapointment.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-52359938448643173012007-06-19T01:51:00.000+02:002007-06-19T01:51:00.000+02:00Anonymous: There are some extreme cases where grep...Anonymous: There are some extreme cases where grep or pcregrep is much faster than another, but nobody cares because they never happen in real life.<BR/><BR/>On the other hand limitations of grep are a big problem all the time.<BR/><BR/>"cat FILE | complicated_command" is idiomatic Unix usage. Shells should have learned to handle such simple cats internally by now. If they haven't (and they haven't), that's a bug. I'm hopeful, however - someone finally started caring about shell usability. Recently shells started telling which package needs to be installed if some unknown command was issued. Some day maybe cp, mv and > will stop overwriting files without being asked to. (you can get there today with alias cp='cp -i', libtrash and so on). It's not like 1980s Unix is the best we can do.tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-11522283170873651752007-06-18T21:34:00.000+02:002007-06-18T21:34:00.000+02:00andre: grep -P is non-standard, not everyone uses ...andre: grep -P is non-standard, not everyone uses bloated crapware filled with excess "features". And there's absolutely no need to use PCR for this (not PCRE, they are not regular expressions at all), grep is fine. Perl's regexs are very bad, you should learn actual regular expressions instead:<BR/>http://swtch.com/~rsc/regexp/regexp1.html<BR/><BR/>And taw, you win the useless use of cat award. Why is it that nobody can be bothered to learn the basics of unix anymore? You aren't concatenating anything, so don't invoke cat!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-78603746038066698262007-05-12T20:47:00.000+02:002007-05-12T20:47:00.000+02:00taw, I understand the focus of your analysis, and ...taw, I understand the focus of your analysis, and agree with where you're coming from. What I'm saying is, that agreement already granted, I think Ruby syntax has some potentially rough patches with nested invocations of functions that accept a single block.<BR/><BR/>A more idle consideration is whether or not functions that take multiple blocks will become more common. The (somewhat) interesting point being that such functions are less necessary (using that word loosely) if you have elegant support for nested invocation of functions that accept a single block.<BR/><BR/>On another note, I disagree with your characterization of Javascript as not containing many higher order functions. Callback-type designs are so common in Javascript that higher order functions are all over the place. There are also a good number of functional programming academics porting techniques to Javascript, which I think will encourage a continued uptake of functional style in the Javascript community.Anthonyhttps://www.blogger.com/profile/00974560355445241032noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-63813442377403047442007-05-12T20:03:00.000+02:002007-05-12T20:03:00.000+02:00Ramon Leon: We can call alternative syntaxes "supe...Ramon Leon: We can call alternative syntaxes "superior" or "more elegant", but languages are much more likely to become popular if they follow established traditions.<BR/><BR/>Traditions can be broken if you get something more valuable in exchange - like macros. I'm just pointing out that supporting block arguments and functional-style programming is not one of such things, as one-block case is handled by fairly traditional Ruby syntax, and multiple-blocks case is too rare to matter.tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-36393029987040333902007-05-12T19:58:00.000+02:002007-05-12T19:58:00.000+02:00Anthony: I compared only one point - syntax for bl...Anthony: I compared only one point - syntax for block arguments. It's a very important one, but not the only.<BR/><BR/>I think most future languages should follow Ruby here - make sure one-block case is handled well, and not sacrifice familiarity just to handle very rare multi-block case.tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-49592181450048623932007-05-12T19:53:00.000+02:002007-05-12T19:53:00.000+02:00Anonymous: I call it "Scheme-like" to be precise. ...Anonymous: I call it "Scheme-like" to be precise. Scheme code tends to be much more functional than code written in other Lisps like Emacs Lisp and CL.<BR/><BR/>Elegance is one thing, but languages with non-traditional syntax very rarely get popular.tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-24966692146540308722007-05-12T19:48:00.000+02:002007-05-12T19:48:00.000+02:00I dislike your whole "traditional syntax" view poi...I dislike your whole "traditional syntax" view point. There's no such thing, it's a popular syntax, but calling it traditional implies it's better and older, neither is the case.<BR/><BR/>You attach too much value to "traditional syntax" as if it's worth a lot to try and keep it. It's not. The C'ish syntax mostly sucks, is totally inelegant, full of exceptions and stuff you have to memorize, and hard to parse and generate.<BR/><BR/>Smalltalk and Lisps syntax on the other hand, are elegant, simple, easy to parse and generate, and simply better in every objective measure of merit in comparison to C'ish languages.<BR/><BR/>"Traditional syntax" doesn't deserve your adulation, rather, it needs to be abolished in favor of the superior alternatives already available.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-20663953645144389512007-05-12T19:47:00.000+02:002007-05-12T19:47:00.000+02:00Mike McNally: First-class function values are cert...Mike McNally: First-class function values are certainly required for the language to be "kinda-functional", but that's a very low standard of being "kinda-functional" - even Perl has them. Javascript code I've seen tends to contain rather few high-order functions, so I don't really count it here.<BR/><BR/>And I'm not sure if it's still that much more popular than Ruby. It used to be so not that long ago, but <A HREF="http://www.tiobe.com/tpci.htm" REL="nofollow">TIOBE thinks the difference is rather small today</A> (not that I trust TIOBE, but flawed data is better than no data).tawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-2713518592571902992007-05-12T19:33:00.000+02:002007-05-12T19:33:00.000+02:00This is some great analysis, but, despite being a ...This is some great analysis, but, despite being a big fan, I think Ruby's syntax still leaves something to be desired. For example, binding precedence can be confusing due to optional parentheses.<BR/><BR/>I often find myself missing the simplicity of Lisp syntax when dealing with a lot of higher order functions. In fact, I don't think my experience is that Ruby's syntax is ideal for 99% of circumstances as your OCaml investigation might suggest, but I'm not sure what percentage it is.Anthonyhttps://www.blogger.com/profile/00974560355445241032noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-60377409738010594452007-05-12T18:18:00.000+02:002007-05-12T18:18:00.000+02:00Why is Lisp-like syntax only "OK"? (I won't even a...Why is Lisp-like syntax only "OK"? (I won't even ask why you call it "Scheme-like"...)<BR/><BR/>I think the most elegant for this would be:<BR/>Lisp-like<BR/>Smalltalk-like<BR/>Haskell-like<BR/><BR/>These win anything Python and Ruby have to offer.<BR/>And they're more elegant ;)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-34004210082272901542007-05-12T16:55:00.000+02:002007-05-12T16:55:00.000+02:00The claim that Ruby is the most popular "kinda fun...The claim that Ruby is the most popular "kinda functional" language is, I believe, not true. Javascript is almost trivially demonstrable as being more "popular", and Javascript supports true first-class functions.<BR/><BR/>Now, it's probably the case that only a small minority of those who make Javascript so popular know that it is in fact a "kinda functional" programming language. And perhaps it gets "ugly" marks across the board ...Mike McNallyhttps://www.blogger.com/profile/15500789708992704945noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-69506347414756220402007-05-12T16:18:00.000+02:002007-05-12T16:18:00.000+02:00As a previous poster mentioned, Smalltalk probably...As a previous poster mentioned, Smalltalk probably deserves some consideration here. Multi-block methods seem more common than in other languages. Especially if instead of "number defined", you look at "number of calls."<BR/><BR/>Not to mention, Smalltalk syntax scales very elegantly from the no-block to the one-block and finally to the multi-block.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-59133055942728995932007-05-12T12:37:00.000+02:002007-05-12T12:37:00.000+02:00Smalltalk:seq sizeseq at: x put: yseq map: [...]se...Smalltalk:<BR/><BR/>seq size<BR/>seq at: x put: y<BR/>seq map: [...]<BR/>seq map: [...] reduce: [...]<BR/><BR/>Note:<BR/><BR/>Space instead of dot: seq size == seq.size()<BR/><BR/>at:put: is one method of two arguments, so is map:reduce:<BR/><BR/>[...] == lambda{...}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-27488238.post-60783871588762673032007-05-12T08:34:00.000+02:002007-05-12T08:34:00.000+02:00Any examples for your initial table on syntaxes?- ...Any examples for your initial table on syntaxes?<BR/>- Paddy.Paddy3118https://www.blogger.com/profile/06899509753521482267noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-18316907219575365392007-05-12T08:26:00.000+02:002007-05-12T08:26:00.000+02:00Slava: If you haven't learned them, no wonder you ...Slava: If you haven't learned them, no wonder you can't see what's good about their syntax.Nataliehttps://www.blogger.com/profile/10786452250723026129noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-65645689208448364332007-05-12T07:57:00.000+02:002007-05-12T07:57:00.000+02:00You can put Erlang in the second group too, I thin...You can put Erlang in the second group too, I think. I just <A HREF="http://www.acooke.org/cute/ErlangsSyn0.html" REL="nofollow">wrote about this</A> today.Unknownhttps://www.blogger.com/profile/11760508644619954982noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-64980558149060197892007-05-12T03:57:00.000+02:002007-05-12T03:57:00.000+02:00Why should one strive for 'traditional' syntax? I ...Why should one strive for 'traditional' syntax? I never learned Python and Ruby, never will, and I don't see why their syntax offers anything over Scheme or Ocaml.Slava Pestovhttps://www.blogger.com/profile/02768382790667979877noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-22566232367215020902007-05-12T02:34:00.000+02:002007-05-12T02:34:00.000+02:00andre: -P doesn't work on Debian/Ubuntu.$ grep -P ...andre: -P doesn't work on Debian/Ubuntu.<BR/><BR/>$ grep -P '\d+'<BR/><BR/>grep: The -P option is not supportedtawhttps://www.blogger.com/profile/16972845140253292628noreply@blogger.comtag:blogger.com,1999:blog-27488238.post-47202499327603980102007-05-12T02:04:00.000+02:002007-05-12T02:04:00.000+02:00HiYou can run "grep -P" to use perl regexes.Hi<BR/><BR/>You can run "grep -P" to use perl regexes.Anonymousnoreply@blogger.com