Arc Forumnew | comments | leaders | submitlogin
Save-table in Anarki: is it different?
1 point by lark 4611 days ago | 20 comments
I'm wondering if save-table in Anarki works differently than in Arc.

The same call to save-table that works in Arc leads into the following in Anarki:

  hash-for-each: expects type <hash> as 1st argument, given: '#(tagged tem (beta #hash((seconds . 1333845321) ....... ; other arguments were: #<procedure: tablist>

  === context ===
  /home/lark/anarki/ac.scm:1116:15: maptable

Or perhaps deftem and inst work differently?


1 point by akkartik 4611 days ago | link

To summarize: templates aren't tables anymore in anarki, so save them using temstore rather than save-table.

-----

1 point by lark 4611 days ago | link

This change in Anarki breaks backward compatibility with Arc.

Is this a goal of Anarki?

-----

1 point by akkartik 4611 days ago | link

http://www.arclanguage.org says "Arc is fluid and future releases are guaranteed to break all your code." As a result the community tends not to care about compatibility either. Anarki has numerous little incompatibilities. Since literally anybody can commit to it at any time it's hard to make any assumptions about it whatsoever.

All of us choose to live in one repo; either arc3.1 or anarki or something of our own. My personal set of favorite incompatibilities is at http://github.com/akkartik/arc, for example. My recommendation: jumping back and forth between arc3.1 and anarki is more trouble than it's worth.

I had to gradually accustom myself to how things work here. Even now I monitor new commits to anarki as I pull them. It can't be like a library you blindly rely on.

-----

2 points by lark 4611 days ago | link

That's a fair response. Thank you for the help and the clarification.

-----

1 point by akkartik 4611 days ago | link

You're welcome! One of the great benefits of this model is that it is literally frictionless to propose new ideas. I hope you will feel free to make your own edits directly to anarki. I'd love to see you post about them here if the rationale isn't obvious, but it's always ok to make changes first and see if anybody complains :)

For example, a while ago I decided that using + for both addition and concatenation was ugly (http://github.com/nex3/arc/commit/49005e3d60). But then a couple of people complained and I reverted (http://github.com/nex3/arc/commit/bd42b93742). We're a small group, so edit wars haven't been a problem so far.

-----

1 point by lark 4611 days ago | link

This might explain it.

  lib/math.arc:390:(def beta (z w)

-----

1 point by lark 4611 days ago | link

Nope, that's not it. A different deftem name still causes this error.

-----

1 point by akkartik 4611 days ago | link

It's probably my change for http://arclanguage.org/item?id=15664 again, just like http://arclanguage.org/item?id=16020. Let me take a look. Can you provide simple failing example?

Update 1: As part of that change I changed how we represent templates. In arc 3.1:

  arc> (deftem foo field1 34)
  arc> inst!foo
  #hash((field1 . 34))
vs in anarki:

  arc> (deftem foo field1 34)
  arc> inst!foo
  #(tagged tem (foo #hash() #hash() . nil))
This makes serialization of templates more reliable, but now templates aren't hash-tables anymore; instead of (maptable ... x) you have to say (maptable ... rep.x).

Does this sound like some code you wrote? I'm looking for any places in anarki that use table functions on templates.

Update 2: I'd forgotten to update blog.arc; that's now fixed (http://github.com/nex3/arc/commit/2bd80ecb65). But I don't think this fixes it for you.

-----

1 point by lark 4611 days ago | link

  (deftem bbb
   code nil)
  (withs (b (inst 'bbb 'code "3"))
         (save-table b (string "/dev/shm/" b!code)))

-----

1 point by lark 4611 days ago | link

temstore worked.

This change in Anarki breaks backward compatibility with Arc. news.arc for example doesn't work after this change.

-----

1 point by akkartik 4611 days ago | link

Great; sorry about that.

I just doublechecked news.arc and didn't see an issue. Can you be more specific? Note that you can't mix news.arc from arc3.1 with arc.arc from anarki because of this incompatible change.

-----

1 point by lark 4611 days ago | link

The issue is that everywhere that one was calling save-table now one needs to replace save-table with temstore.

One needs to modify the application so that saving works again.

-----

1 point by akkartik 4611 days ago | link

That is so, yes. Since arc can change at any time, to use it you have to be open to changing your app anytime you pull in updates. It's one of the reasons arc is small; it has no bloat from historical baggage. I've given up and even keep my own code directly in the arc directory.

I'm curious what your current setup is. Are you running off of anarki? Or copying parts of it over to your own repo?

-----

1 point by lark 4611 days ago | link

I'd rather not fork my own copy of Arc.

All I want is to be able to upload a file. Arc can't do it, Anarki can. Arc can change at any time, but Arc did not change in a long time.

I also noticed the following since switching the app to Anarki:

  procedure ...nk/anarki/ac.scm:972:33: expects 1 argument, given 0

-----

1 point by rocketnia 4611 days ago | link

I just looked in Arc 3.1, in all of Anarki's branches, a few commits back in Anarki's master ac.scm, and I didn't find anything at line 972 that would cause an error like that.

I did notice that some functions that are supposed to expect 1 argument in news.arc currently expect 0, so I fixed that: https://github.com/nex3/arc/commit/f311b3879c15a27518bbe0fad...

I don't know where to start testing news.arc, so please speak up if I've made things even worse.

-----

2 points by rocketnia 4611 days ago | link

Looks like I came in just after akkartik noticed the same thing, and I just fixed some overlooked places. XD

-----

1 point by akkartik 4611 days ago | link

I think I tracked this down. Can you pull from github?

-----

1 point by akkartik 4611 days ago | link

I'm still curious if you were seeing an issue in news.arc on anarki outside of your own code. If so I really should fix it, but I don't see anything wrong so far. When I made the change I tried to be careful and replace save-table with temstore: http://github.com/nex3/arc/commit/c125d0330c.

-----

1 point by akkartik 4611 days ago | link

Instead of (save-table ...) say (temstore bbb ...).

If you copied this way of doing things from somewhere, let me know and I'll try to update it.

-----

1 point by lark 4611 days ago | link

Is there a stable Anarki I could use in the meantime?

-----