Arc Forumnew | comments | leaders | submit | aw's commentslogin

That's interesting that Haskell also uses the term "implicit". The differences seem mostly related to the type system. For example, since the variables are statically typed, it's easy for them to overload "let" to do dynamic binding with implicit parameters. Is there some other subtle difference that I'm missing?

The "it's always been called X before" argument would prevent us from ever improving the language by coming up with better names; we'd still be calling anonymous functions "lambda" instead of "fn" etc.

-----

1 point by rntz 5963 days ago | link

Er, see the post you replied to: that code I gave is precisely the same modulo syntax, but in Common Lisp it evaluates to 1 and in Haskell to 0. Essentially, Haskell's implicit variables don't allow rebinding/shadowing. It's a bid hard to explain, but look at the example and play around a bit and you'll see what I mean.

-----

1 point by aw 5962 days ago | link

Ah, I don't know enough Haskell to really be able to see what's going on. Thank you for the description though.

-----


I have some code that defines the request variable req dynamically, so that instead of

  (defop foo req
    (pr (arg req "bar")))
I can say

  (idefop foo
    (pr (arg "bar")))
I found myself thinking in my own mind "OK, so here in this code I'm using req implicitly..."

Good names for concepts are always valuable, so paying attention to what my mind was calling this, I thought "Hmm, how about the name 'implicit variables'?"

-----


Sounds fine to me.

Though I suppose if you have zillions of users you might not want to be using up your memory making Arc instances for each one.

There's no benefit to having more Arc instances than you have CPU's, at least in terms of using all your CPU's.

So you might assign each user to one of four Arc instances.

Having a particular user always go to one Arc instance is useful since you don't lose your in-memory data structures like fnid's for that user.

For communicating between Arc instances you don't have to use JSON, though you certainly could, you could use Arc's read and write to be communicating with Arc data instead. It probably doesn't make a big difference either way.

-----

1 point by thaddeus 5979 days ago | link

thanks... &

> you might not want to be using up your memory making Arc instances for each one

Yeah I was thinking of using 4 to 8 instances, but scaling is a good question... when to add more :)

-----

1 point by aw 5979 days ago | link

I haven't done any testing along these lines, so I don't know what the actual answer is, but I don't think adding more Arc instances than you have CPU's would do anything except use up more memory...

edit: though I suppose it's possible that garbage collection times might not scale linearly... if it takes more than twice as long for the garbage collector to run on twice as much data, then a larger number of smaller processes might give you some kind of performance benefit.

-----

1 point by thaddeus 5979 days ago | link

that makes sense... I'll stick with 4 then.

-----

3 points by aw 5980 days ago | link | parent | on: Confusing types: string port and file port

One conceptions of a "type" is to consider it as a logical representation of a particular set of operations, and a value is a member of that type if it supports those operations. Under this conception, as you say, either string ports would need to be a subtype of ports with "inside" as an additional operation, or file ports ought to support "inside" somehow if file ports and string ports are to have the same "type".

Another conception is to consider types as merely a label that we can attach to a value when it's useful, one trick in a bag of tricks for writing concise code.

The label isn't a precise promise, any more than if I scribble "living room stuff" on a box when I'm moving is a promise that the box is only going to contain precisely and only living room items. It's just a convenience to remind me to dump the box in the living room. Likewise labeling a value as a "port" or a "string" is helpful in a function that I want to take different actions depending on the label, but I don't have to be labeling the value in excruciating detail just to do that.

Under this second conception, a proposal to make (type (outstring)) or (inside (outfile)) return a different value would be met with a question "how would that help me write programs more concisely?"

Of the languages that I'm familiar with, Haskell really takes the idea of a type as a mathematical set of operations and implements it seriously. I found Haskell elegant and intriguing, but when I tried to write applications I found myself spending way too much time writing extra code to make the type checker happy. Which is supposed to pay off in fewer bugs, but not many of my bugs end up having been type related, so it wasn't actually helpful to me.

So in my own experience writing applications, Arc's not having a strict "set of operations" conception of type has been a big win. At least for me. Certainly I enjoy writing programs in Arc much more than I did in Haskell.

Of course, someone who prefers Haskell would likely have the opposite opinion.

-----

1 point by zhtw 5980 days ago | link

> "how would that help me write programs more concisely?"

Ok. This is after all the most relevant question.

But my point is although it's not necessary to worry about the difference between outport and outfile from the user's point of view, it's certainly impossible to ignore them when you implement these functions. You kind of have to since you need to know whether or not inside is allowed for a particular object. Whether to make this information visible for the user is another question.

-----

2 points by aw 5980 days ago | link

One conceptions of a...

Ouch, I hate noticing I made a glaring typo after the edit window has closed...

-----


That's good to know about being able to edit the first letter back to lowercase -- on occasion I've started a title with a function or macro name that should be uncapitalized.

-----

1 point by aw 5983 days ago | link | parent | on: Ask ArcLang: What do you write Arc in?

1) I use Emacs (mostly because I've always used Emacs), but I haven't tried its syntax highlighting mode.

2) Check out Ken Shirriff's extensive documentation on arc2 http://arcfn.com/doc/index.html plus his description of "what's new in arc3": http://arcfn.com/2009/06/whats-new-in-arc3.html

Arc is so young it doesn't have many libraries yet. Some are in Anarki (http://github.com/nex3/arc) and on my site (http://awwx.ws/)

-----


If you prefer not to have all the changes that Anarki makes to Arc, the http://awwx.ws/ac patch adds just the ability to drop into Scheme from Arc.

-----

2 points by akkartik 5982 days ago | link

And once you have $/ac-scheme, you can load libraries through scheme's FFI, or load scheme libraries say for parsing json.

I'm not using anarki, just pieces that I like.

(sorry, addressing grandparent)

-----

1 point by aw 5989 days ago | link | parent | on: using MySQL with arc?

That's cool. It's a neat idea that by default (if there isn't an explicit reason why you have to do something else), all interfaces can be HTTP, and as a bonus use JSON as your data interchange format...

-----

1 point by thaddeus 5988 days ago | link

Exactly. The concept is great. Even now when I am starting to learn haskell, the first thing I am doing checking out haskells' JSON parser to communicate via HTTP. Conceptually I can keep doing this and communicate easily across any language. And since SQL to URL is so basic I can re-use/apply dbslayer to any language too.

-----

1 point by aw 5988 days ago | link

Aha, I knew I'd seen some post that talked about this, and I found it: http://timothyfitz.wordpress.com/2009/02/12/why-http/

-----

1 point by aw 5989 days ago | link | parent | on: Scheme version of JSON

What input did you give the parser that gave that error?

akkartik reports that the Scheme version is substantially faster. I have it working with the hackinator: http://arclanguage.org/item?id=10848

-----

1 point by thaddeus 5989 days ago | link

Sorry aw; I messed you up and edited my post after you replied....

see http://arclanguage.org/item?id=10942 - I fixed it on my own.

Here was the original case example:

  (fromjson "{\"RESULT\" : {\"SUCCESS\" : true} , \"SERVER\" : \"cool dude\"}")

-----

1 point by aw 5989 days ago | link

This is what I get:

  $ hack ycombinator.com/arc/arc3.1.tar awwx.ws/parsecomb0.arc awwx.ws/fromjson0.arc
  /tmp/4uG5ClxUqg
  ycombinator.com/arc/arc3.1.tar
  awwx.ws/parsecomb0.arc
  awwx.ws/fromjson0.arc
  mzscheme -f as.scm
  Use (quit) to quit, (tl) to return here after an interrupt.
  arc> (fromjson "{\"RESULT\" : {\"SUCCESS\" : true} , \"SERVER\" : \"cool dude\"}")
  #hash(("SERVER" . "cool dude") ("RESULT" . #hash(("SUCCESS" . t))))
  arc>
Are you possibly using an earlier version?

-----

1 point by thaddeus 5989 days ago | link

yup - sorry. I didn't update to the last version :)

-----


Is there a kind of program you'd like to be able to write?

By analogy, first you say you want to get into transportation, and someone says "OK, here's how to learn how to fly a plane, ride a bicycle, drive a car, pilot a submarine..." and you say, "oh, I'd really just like to learn to sail", and that narrows it down to something where it's easy to say, "oh, OK, here's where to go to learn to sail".

So if you think of a kind of program that would be useful to you, we can better suggest how to get started with the basics of doing that :-)

-----

1 point by crownoflaurel 5989 days ago | link

A program that counts words, periods, commas, sentences? That would be nice for my writing, or at least interesting. I've always wonder how many periods I've used....

Sorry, but that's really all I can think of. I'm not even certain I know what is and isn't a program.

-----

1 point by aw 5989 days ago | link

OK, you'll want to install Arc on your own computer, so that you'll be able to read your file which has your text in it.

What kind of computer do you have? Mac? Windows? Linux?

-----

1 point by crownoflaurel 5989 days ago | link

My school computer is a Mac, but I don't think it'll let me install anything on it.

My home computer is Windows.

-----

More