.
arc3 is a major change from arc2, with about 3000 lines and most files changed. The following gratuitous pie chart illustrates that the largest number of changes are in the news server (news.arc), with many changes to the fundamental language (ac.scm and arc.arc) as well as the web and application servers (app.arc and srv.arc).
The news server has been heavily modified with new ranking, support for polls, and improved spam rejection, among other features. A new "how-to-run-news" file explains how to set up your own Hacker News-like server. I will discuss the news server, web server, app server, and html library in more detail in a future article. I will focus this article on the language and main libraries.
If you're looking to try arc3, it can be downloaded here. Arc3 has significant incompatibilities with previous versions that will cause problems if you're not prepared.
Incompatibilities
- Arc now requires mzscheme 372. Arc will not work with the version 352 required by arc2, or with the newer versions of mzscheme.
flush-outputis disabled by default onwrite,disp, and functions that use these. Seedeclarebelow.- The result of accum is no longer in reverse order.
news.arcis no longer loaded as part of arc.a.b.cis now((a b) c), not(a b c)a!b!cis now((a 'b) 'c), not(a 'b 'c)- The
setfunction has been renamedassign, and theassertfunction has been renamedset. writefile1removed.flatno longer supportsstringstoooption.to-nearestrenamed tonearest.random-eltrenamed torand-elt.firstn-thatrenamed toretrieve.pluralrenamed topluralize.
New functions
intfunction coerces to an integer.force-closediscards buffered output and closes the descriptor.mvfilemoves a file.memoryreturns the current memory use.sin,cos,tan, andlogare finally available.declareis used to set system variables:explicit-flushto control automatic output flushing, anddirect-callsfor the function call optimization.timedateconverts seconds to date.copylistcopies a list.defsappliesdefto name, args, body triples to define multiple functions at once.getprovides simpler table / array lookup.get!foocreates a function that takes a table and looks up'foo. (Actually, it's a generic mechanism to create a function to apply an argument to something.)writefilewrites to a temporary file first.lettertests if a character is a letter.sumsums up function results.medreturns median of list.minutes-sincereturns minutes since a time.defcachewrapper aroundcacheto reduce boilerplate.datestringcreates "y - m - d" string.or=modifies a variable if the variable is false.outevaluates and prints an expression.fromdisk,diskvar,disktable, andtodiskprovide a simplified mechanism for loading and storing data.halvesplits a string in two on the first separator.positionsreturns a list of positions where a test is true.linessplits a string into lines.urlencodeurlencodes a string.nonblankreturns a string if it's nonblank.pluralreturns a count and pluralized word.
Bug fixes
atomic-invokefixed.socket-acceptuses custodians so web servers can forcibly close connections if the clients aren't reading data.coerceof string into int rounds the value as does number to char.listmodified to copy the list.safesetnow writes warnings to stderr.eachfixed to avoid conflict withafn.cutfixed.truesfixed.whilerfixed.rand-stringnow more random to help fix huge security hole.splitfixed for negative positions..memonow memoizesnilresults too.readlinewill terminate onnil.copyfixed.hours-sincefixed.datefixed to avoid system operation.interspersenow works withnil.loadfixed.posmatchfixed.numfixed to handle negative numbers.
Optimizations
-
complementin function position - The
<,>, and+operations when applied to two arguments. -
(foo bar)is optimized to callfoodirectly iffoois a global bound to a function. This is controlled bydeclare.
Other changes
- Debugging has been improved by giving the Arc names of things to Scheme, and turning on line counting.
- A default value can be provided when accessing a hash table.
- Currying was largely implemented but not enabled.
Disclaimers: I have provided my interpretations of the changes in arc3, and I'm sure there are some errors; please provide feedback if you find mistakes. Note that I am not connected with the arc team in any way, and this is not an "official" list of changes. In addition, arc3 may change without warning, so any of the above can be obsoleted. (There are some good reasons for real version numbers, bug tracking, and source code control, but I won't belabor that point.)
6 comments:
Impressive; thanks. But I think out= should be just out.
Thanks for looking it over. Yes, I got out and or= mixed up.
Also a.b.c and a!b!c are now ((a b) c) and ((a 'b) 'c)
http://arclanguage.org/item?id=9163
Thanks, Anonymous. I've fixed that.
Did only get in before arc3? The timing is off.
Kartik, the "only" function has been in arc for a long time: (documentation)
Post a Comment