Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lotta changes #1

Closed
wants to merge 61 commits into from
Closed

Lotta changes #1

wants to merge 61 commits into from

Conversation

Pauan
Copy link
Contributor

@Pauan Pauan commented May 25, 2011

I know it's a lot of changes, I'll try to send pull requests in smaller chunks from now on. On the plus side, I've kept up with merges, so it's up-to-date with base ar (excluding the changes I made, of course), so it'll hopefully be easy to merge.

I'll list out some of the big changes that you'll want to know about:

  1. Arc is now split into 3 files: core.arc, base.arc, and arc.arc.

core.arc is the absolute bare minimum super-important stuff like def, let, etc. I would also expect the ar compiler to go into there, and also a reader written in Arc could be put into core.arc

base.arc is stuff that's still suuuuper useful and common, like each, map, =, etc. but it's still lightweight compared to arc.arc

arc.arc then contains everything else (excluding io.arc and repl.arc, of course)

To be more specific, base.arc contains stuff that I need/am interested in while I'm developing Arubic, since Arubic only loads core.arc and base.arc, which lets it load up waaaay faster than Arc.

  1. All Arc tests are implemented with my Python-style tester. So now you use ./arc run-tests rather than sh tests.sh. It also supports some neat stuff like a -v/--verbose flag and the ability to load up individual tests, rather than all of them. It does this with a simple command line argument parser, which is found in "lib/parse-script-args.arc"

  2. ac.ss is exactly the same as in ar, except that it implements special forms as gensyms, "apply" coerces to an fn when it doesn't understand it's argument (which gets you something similar to defcall), and racket-eval doesn't parameterize current-readtable.

  3. I've added in a bunch of functions to arc.arc that I needed/wanted/seemed useful. I also fixed some bugs, tidied some things up, stuff like that. For instance, "dynamic" and "implicit" are a lot cleaner, no mucking around with "with" or "sref sig" or any of that junk.

All the things I talked about before (srcdir, curdir, script-args, script-src, etc.) are implemented and neatly categorized in arc.arc.

Oh yeah, and just a little thing that you might find neat. You know how w/infile and such expand into the "expander" function, which is hidden in a "let"? Well, I put in a "make-w/close" macro, so now you can easily make your own w/ stuff. For instance, here's the implementation of w/pipe-from:

(make-w/close pipe-from)

I still want to tidy up w/appendfile a bit, but I'm pretty happy with it overall.

Pauan added 30 commits April 24, 2011 11:55
… custom behavior for objects that are in functional position, ala defcall.
… appear that fn is a first-class value, even though the gensym is hardcoded into ac.
…g with coerce, but also allows for apply to be used on macros!
Also adding a letr macro

Renaming acons to cons?
Renaming alist to list?
Renaming no to not

Also putting in an "arc3.1/backcompat.arc" file. This creates aliases for acons, alist, and no
Removing `ac-complex-getargs` because it isn't used anywhere

defrule now binds `orig` to the original function
symbols. This allows things like quote, fn, assign, etc. to be
overwritten/shadowed

ac.ss also exposes the gensyms as ordinary variables in Arc, prefixed with
%%internal- So, fn is now %%internal-fn, quote is %%internal-quote, etc.

But even the %%internal- variables aren't hardcoded, so they can be
overwritten/shadowed by Arc

This makes it appear that all special forms are first-class, even though
technically they use gensyms underneath
Conflicts:
	ar.ss
	arc.arc
	as.ss
It's now false by default, but if you don't specify any files, it'll go into the REPL.
pass except for one (which is intended to fail, since it's
unimplemented)

The old re.arc is available at "lib/re.arc.bak"
Conflicts:
	ac.ss
	ar.ss
	tests.sh
Hash tables also print out nicer now:

  1. Keys are displayed in alphabetical order
  2. Newlines/whitespace is inserted to make it easier to read

As an example, (obj a 1 b 2 c 3) would print as:

  #hash((a . 1)
        (b . 2)
        (c . 3))
them. You can tell it to load all the files by using -a or --all

Also, now the srcdir* variable is exposed to Arc
Adding in curdir, dirname, basename, and ifdlet

load now handles subdirectories properly
Adding in joinpath, abspath, and absdir

Adding in racket-vector->mlist and racket-mlist->vector

Adding in env, script-args, script-src, and w/script-dir

Also fixing some bugs with curdir, load, dirname, and basename

ifdlet is no longer necessary and has been removed

Renaming toscheme to toracket, and also exposing it to Arc
Removing tests.sh because it's no longer necessary
Use ./arc run-tests instead
Pauan added 28 commits May 22, 2011 05:39
Fixing some bugs with script-args, joinpath, dirname, basename, and curdir

Also tweaking the "arc" file
their argument

Also changing `empty` so (empty '||) returns t
`warn` now prints to stderr rather than stdout
Fixing the problem with tests/arc by moving some more stuff into base.arc
`pipe-from` now uses Arc's stderr, so error messages should work okay now

`quit` now works just like racket-exit, so it accepts an argument now
This fixes a problem where `load` didn't understand square-bracket
Adding in assoc-ref, which allows you to scar the assoc

Adding in make-w/close, which creates things like w/infile, w/socket, etc.

Adding in setters for assoc and alref, so you can now do
(= (alref foo 'bar) 'qux) to assign to an association list
Adding intersect, set-diff, and diff (functions that return sets)
Conflicts:
	ac.ss
	ar.ss
	arc
	arc-test.ss
	arc.arc
	io-test-root.ss
	io-test.ss
	primitive-repl.ss
	readme.md
	strings-test.ss
	tests.sh
	tests/ac-test.ss
	tests/ar-test.ss
this can be changed to racket/ later

Fixing all the special forms so they're gensyms, allowing for overwriting/
shadowing things like fn, if, assign, etc.

Fixing it so when `apply` doesn't understand something (hash table, string,
etc.) it will try to coerce it to an 'fn, rather than throwing an error

Also, racket-eval no longer parameterizes current-readtable
Also changing sread to use ar-read rather than racket-read

This is because ar-read already parameterizes racket-current-readtable,
so it's better to just use ar-read
w/object is no longer needed and has been removed

isa now understands multi-type objects

Adding in del, which can delete object attributes and hash keys
I plan to add in more functionality to del later
…ists:

  (foo 2 5)               ; return the slice [2,5)
  (= (foo 2 5) '(4 5 6))  ; splice a list into the slice [2,5)

In order to accomplish this, I fixed sref so it sends all it's arguments
rather than only the first:

  (= (foo 1 2 3) 'bar)

Now expands into:

  (sref foo 'bar 1 2 3)

I also fixed nthcdr so it is a *lot* faster when given an index beyond the
length of the list. For instance, this...

  (nthcdr 5839949410410444 '(0 1 2 3 4 5))

...used to take a really long time, but now it's very fast.
Also, now (isa (object) 'object) is t

Also starting some work on fixing `is` so it works correctly...
@awwx
Copy link
Owner

awwx commented May 31, 2011

I added these as "todo's" to the readme; let me know if I missed anything.

@awwx awwx closed this May 31, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants