Arc Forumnew | comments | leaders | submit | almkglor's commentslogin
2 points by almkglor 6316 days ago | link | parent | on: Proposed new axiom: symeval

err, it's not a library, it's a full implementation of Arc.

I'll probably also include some method of locking the global (and only the global) but only with a lot of big warning signs around the locking function, saying that this should be used only if efficiency is a real concern. Also, my intended lock is a true lock: no redefinition of the <edit>global</edit> at all.

Also, ssyntax could potentially help with the apparently long symeval!foo form; say: <>foo maybe?

-----


What's so bad about generating function values? The function code is already precompiled, the only thing that (fn ...) does in run time is capture non-global free variables. So 'really-hard-working-optimizing-compiler just needs to output a compileable s-expression, and it will be compiled just once.

-----

1 point by CatDancer 6316 days ago | link

just needs to output a compileable s-expression

I'm speculating here, but maybe I'm in a hurry and I want to use something in my macro without taking the time to rewrite it so that it produces an s-expression.

I actually don't know if having a macro expand into a function value would be useful for anything; I just noticed a way to do it and posted the solution in case it would be useful to somebody someday. (Not realizing that apparently this has been fixed in Anarki already).

-----

1 point by almkglor 6317 days ago | link | parent | on: Inheritance Idea

The lack of the ability to subclass has been galling. Take a look at the "Create your own collection" series, for example. Each of them emulate tables, but they need to do a lot of background hackery just to emulate tables. And it's hard to determine which subclass of tables it uses.

So I introduce "zen typing". You wear a blindfold (i.e. ignore the type) and just code as if the existing functions will work. Let the functions fight over how to exactly implement them ^^

-----

3 points by almkglor 6317 days ago | link | parent | on: What can't LISP do?

Eh, but the problem is the assumption that the world itself cannot be modelled as part of the tape that the Turing Machine eats.

From a quick glance through the paper and the LtU comments it seems that its point is that interactive I/O cannot be modelled by the Turing Machine.

But as I've learned in Haskell, I/O can itself be mathematically treated, specifically by monads: the world-before-i/o-event is the monad that is input to a function, and the world-after-i/o-event is the monad you return. And I'm pretty sure that monads themselves can be modeled by TM: they can be represented by a part of the tape that the TM gets to and modifies, just like any function-to-TM mapping.

-----

4 points by cchooper 6317 days ago | link

The problem is that the paper uses words like 'model' and 'function-based' rather vaguely. You can model I/O with a TM, but you can't actually do it, which is what they're getting at.

-----

4 points by almkglor 6319 days ago | link | parent | on: What can't LISP do?

  char* x = (char*) 0xf80;
  int i;
  for(i = 0; i < 128; ++i, ++x){
      (*x) = (char)i;
  }

-----

8 points by brucio 6318 days ago | link

  (let ((x (sb-sys:int-sap #xF80)))
    (dotimes (i 128)
      (setf (sb-sys:sap-ref-8 x i) i)))

-----

1 point by almkglor 6318 days ago | link

  typedef void fntype(int);
  ((fntype*)0xf80)(42);
^^

-----

3 points by brucio 6318 days ago | link

I'm guessing you're not familiar with SB-ALIEN.

-----

1 point by almkglor 6318 days ago | link

Well, you stumped me now^^

I guess Lisp wins then ^^

-----

1 point by bOR_ 6318 days ago | link

That one requires anarki?

-----

3 points by brucio 6318 days ago | link

It's SBCL, but the point is any serious Lisp will have the facility to do the same thing.

-----

1 point by rntz 6318 days ago | link

That depends on how you define "serious". I doubt there are many Schemes with the ability to write into arbitrary regions of memory.

-----

2 points by brucio 6318 days ago | link

Serious Schemes let you do this, or let you add it without much trouble.

-----

1 point by rntz 6318 days ago | link

Really? Can you list the lisps (common lisps, schemes, whatever) that let you do this kind of stuff? And tell me why the ones that don't aren't "serious", according to you?

-----

6 points by brucio 6318 days ago | link

SBCL, CMUCL, LispWorks, Allegro CL, CLISP, etc. make it easy.

I don't habitually use Scheme, but Rob Warnock used MzScheme for hardware debugging all the time; check google groups for "rob warnock scheme mmap".

Lisp is a general purpose programming language; no less so than C. If you can't do anything C can do with your Lisp, it's time to upgrade your Lisp.

-----

3 points by rntz 6307 days ago | link

So, according to you, Python isn't "general-purpose" and Haskell isn't "serious"? I could list many more languages here, of course, but my point is obvious.

It's useful to be able to do lowlevel bitflipping stuff, that I don't deny; and I am suitably impressed by the number of lisps that have put thought into allowing this. But just because a language lacks such capabilities doesn't mean I'd rather use C, or even Lisp! And often, if I'm really interested in lowlevel stuff, I'm also intimately concerned with things like speed and memory usage that I can't necessarily address even in a highly optimized lisp. For example, all lisps need GCs (what if I want to write a GC? I'd rather not have my GC itself need GC, and I'm not learned enough concerning the implementation of eg. SBCL to, like the writers of T, write a GC in it such that the GC needs no GCing), and any Common Lisp necessarily comes with a huge standard library attached.

-----

3 points by rntz 6318 days ago | link

I'm unclear. Is this supposed to demonstrate that Lisps can't write arbitrary regions of memory, or that Lisps don't segfault easily? :P

-----

2 points by brucio 6318 days ago | link

I don't know about your Lisps, but mine segfaults constantly. (It also handles the segfaults.)

-----


The equivalent in Anarki is '$ :

  (($ semaphore-post) s)
Also, I've already exposed semaphores in Anarki. http://arclanguage.com/item?id=6204 http://arclanguage.com/item?id=6802

Anarki needs some serious documenting T.T

Edit: as an aside, $ is a "reserved" variable in SNAP; I intend to use it as a sort of "implementation-specific" variable, so any use of $ should be attached very tightly to the implementation of Arc.

-----

2 points by CatDancer 6320 days ago | link

Yes, $ does the same thing, but it evaluates at run time while I wanted something that evaluated at macro expansion time.

-----

3 points by almkglor 6322 days ago | link | parent | on: History of T

Interesting. So apparently dataflow analysis is hard. Hmm.

Ah well; never mind that, first I gotta implement blocking I/O in a green-threaded environment.

-----

3 points by antiismist 6321 days ago | link

"In short, the fundamental item the classical data-flow analysis algorithms need to operate is not available in a Scheme program."

Anyone know what the problem was/is?

-----

5 points by stefano 6321 days ago | link

Suppose you write from the repl:

  (def car (x) (my-bizzare-computation))
Now you would expect every function that references car to use your new version. If you can't trust basic functions such as car, data-flow analysis becomes very hard. I'm not an expert and I have only a vague idea of what data-flow analysis is, but I think this could be the problem. This is only what I think, so I could be completely wrong.

-----


2. Try using the Anarki repository http://arcfn.com/2008/02/git-and-anarki-arc-repository-brief... . I believe this issue is related to the "date bug", where PG used a MacOS(?) specific system call to get the date. Have you tried looking if there are messages on the terminal where you ran Arc?

3. There isn't any. In fact arclanguage.com has indeed been visited by spam.^^

-----

2 points by antiismist 6321 days ago | link

With spam in news.arc administrators can:

- kill the submission

- delete the submission

- ban the url

- ban the submitting IP

-----


Note by the way that this is the problem that macros in arc2c face: in a single compilation unit, a function defined earlier must be callable from a macro actually used later ^^. Also, to preserve as much of Arc's semantics as possible, a macro could be redefined in a single compilation.

^^

SNAP would sidestep this largely by simply using bits of arc2c only as part of eval - basically eval is simply:

  (def eval (e)
    ((to-free-fun:bytecode-compile:arc2b-compile e)))
... where arc2b-compile is the bits of arc2c modified to emit the bytecode as a list of symbolcodes, bytecode-compile accepts that list and returns an opaque abstract bytecode-sequence object, and to-free-fun creates a free function (one without any closed variables, i.e. all free variables are globals).

So SNAP will compile expressions one at a time.

However arc2c reads the entire compilation as one big expression, hence the difficulty. It may be possible to modify it so that it compiles files one expression at a time though; possibly this could be done by targeting to a bytecode, and then writing a bytecode-to-c transformer, but it loses some global optimizations (oh well).

-----


^^nice

Although it might be better to make a thread pool, where each Arc-side thread is a "task" (which will reschedule itself until it ends), much like how Erlang does it and how SNAP will eventually do it. This will allow you to easily launch and destroy thousands of Arc-side threads on a machine with far fewer cores.

Of course there's the minor problem of I/O then... you'll have to use nonblocking I/O in the VM and emulate blocking I/O on the Arc-side by setting up a poll for the Arc-side task.

-----

More