tag:blogger.com,1999:blog-7045524330253482541.post7012582870622213282..comments2024-01-04T22:19:45.990-08:00Comments on Jim McBeath: Scala Operator Cheat SheetJim McBeathhttp://www.blogger.com/profile/10541190774989580614noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-7045524330253482541.post-32890891997375837212015-03-24T05:48:44.160-07:002015-03-24T05:48:44.160-07:00Great script. And thanks for the data munging scri...Great script. An<a href="http://wdfshare.blogspot.com/2012/11/download-red-alert-3-for-rip-100-working.html" rel="nofollow">d</a> thanks for the data munging script as wellAnonymoushttps://www.blogger.com/profile/06968805594098877350noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-10129934885871743382013-07-22T13:21:04.574-07:002013-07-22T13:21:04.574-07:00The link to Rickys post has changed. This is the n...The link to Rickys post has changed. This is the new one:<br />http://scala-programming-language.1934581.n4.nabble.com/Too-many-uses-for-quot-gt-quot-in-Scala-td2000270.html#a2000271MEMarkhttps://www.blogger.com/profile/06033573917557524827noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-3420556413122048102010-07-26T14:59:45.992-07:002010-07-26T14:59:45.992-07:00Great script. And thanks for the data munging scr...Great script. And thanks for the data munging script as wellUnknownhttps://www.blogger.com/profile/02633237664058475673noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-80413307142225146482008-12-22T21:00:00.000-08:002008-12-22T21:00:00.000-08:00Doug: Indeed, Scala can be hard to read. The comb...Doug: Indeed, Scala can be hard to read. The combination of type inference and implicit conversions can make it difficult to determine the type of a variable, and that's what you need to know to find out what the operator does.<BR/><BR/>A well designed library tries to use operator symbols in ways that are generally accepted as "standard": + means add or concatenate two things, += means add something to the object, | means alternate, >>= means bind, etc. But sometimes the interpretation is not so straightforward. ! can mean send, but that doesn't necessarily tell you what it does. The class author is free to use whatever operator symbols he wants, and his interpretation of "alternate" or "add" may not match what you expect. The bottom line is that an operator might be doing something very different from what you expect if it comes from a different class than you thought it did.<BR/><BR/>I am not familiar with the example you cite, but in Tony's <A HREF="http://www.nabble.com/-scala--ANNOUNCE%3A-Slinky-2.1-to21086159.html" REL="nofollow">announcement of slinky</A> on the Scala mailing list, he says it uses combinators for putting together Request=>Response functions, so I would guess those operators are combinators, perhaps in <A HREF="http://code.google.com/p/slinky2/source/browse/trunk/src/main/slinky/http/request/Request.scala?r=9" REL="nofollow"><BR/>slinky.http.request.Request</A> or <A HREF="http://code.google.com/p/slinky2/source/browse/trunk/src/main/slinky/http/response/Response.scala?r=9" REL="nofollow">slinky.http.response.Response</A>.<BR/><BR/>If you download the slinky source, maybe you can run scaladoc on it and then run the above extraction script on the scaladoc to get a list of the operators in that package.<BR/><BR/>As far as using words instead of operators, some people think operators are sometimes superior. In a <A HREF="http://www.nabble.com/Re%3A--scala--Too-many-uses-for-%22%3D%3E%22-in-Scala-p21129224.html" REL="nofollow">recent post</A> on the Scala mailing list, Ricky Clarkson said "Generally, words interfere with your reading far more than symbols do," with Scala's parser combinators as an example.Jim McBeathhttps://www.blogger.com/profile/10541190774989580614noreply@blogger.comtag:blogger.com,1999:blog-7045524330253482541.post-14974941880314195222008-12-20T08:20:00.000-08:002008-12-20T08:20:00.000-08:00I'm seeing other scala code that uses operator...I'm seeing other scala code that uses operators I don't understand, and they aren't listed here.<BR/><BR/>For example see this sample:<BR/>http://code.google.com/p/slinky2/source/browse/trunk/demo/src/main/slinky/demo/App.scala<BR/><BR/>Line 43: "say(phrase | "Pass the phrase request parameter")"<BR/><BR/>Does that mean if phrase is null, use the string instead? I didn't know the | operator could be used like that.<BR/><BR/>Line 105: ") >"<BR/><BR/>Does the > operator there mean "map"? I didn't know the List class had an operator like that. It's not in the docs.<BR/><BR/>I'd almost prefer people used words for non-common operators instead of symbols.Doug Holtonhttps://www.blogger.com/profile/02740763550543657462noreply@blogger.com