Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
A wishlist of backwards incompatible things for a future Racket2.
Note: This is a wishlist. There's no guarantee any of these will be in a Racket2.
Drop more guarantees about new object allocations: for example, allow
(append lst '())to return
lst, and the same for other list, string, bytes, vector functions (drop 0 items from the end of a list,
regexp-replacethat don't change a string, etc).
cond's default else-is-void clause and replace with a default else-is-error.
matchto recognize clauses based on bindings instead of symbols, and make it treat
Make every place where binding variables currently appear allow arbitrary match patterns (this requires some thought for handling what is currently things like
(define (f x) ..), so maybe we do this in a more limited way or change that way of defining functions to use a new keyword)
Building on the match allowance, also allow functions to be defined case-by-case, for example maybe using a notation like this (roughly allowed in all internal definition contexts where
:=is the keyword that triggers this kind of parsing):
(length '()) := 0 (length (cons x y)) := (+ 1 (len y))
And, even better, have this turn into
define/contract or maybe
provide/contract if something like this is written:
length : (-> list? exact-nonnegative-integer?) (length '()) := 0 (length (cons x y)) := (+ 1 (len y))
match) to use
More prefabs for basic values, especially ones like srclocs where it is useful to make cross phase movements easy.
Enable internal definitions everywhere. (Note: this is tricky -- what's "everywhere"? Eg, can
define idbe followed by a definition(s) and then a value? How about in the middle of an
if? Taken to an extreme, could definitions appear in an application form?)
change syntax-case to allow internal definitions (possibly by getting rid of the 'guard' section)
Use keywords in more places, such as unifying
Some syntax that avoids the verbosity in the
keyword-applyetc kind of functions in the common case of passing keywords around.
Some solution to the "no-value" value, which could be such a blessed value, or it could be a way to say that some function accepts all the keywords as some other function. (Possibly related to the above, of course.)
structdefinition macro that allows
- naming of the accessors/constructors/etc
creating a constructor that takes all fields (when
#:autovalues should be something different)
creating a constructor that makes
#:autofields optional keyword arguments
structhave a function-like form that can specify auto values as optionals and/or keywords
- maybe even allow several constructors with different argument "shapes"
- more ideas from CL, like a
structkeyword that actually use (tagged) lists for the values, similar to prefabs (and possibly redundant because of them)
- like sstruct2
Have only either
define-struct. Not both.
Disallow mutation of
include pattern matching forms in more binding positions (e.g.
Generic programming by default:
fold, and friends are generic and not specialized to lists.
Get rid of the
arity-at-leaststruct, and replace it with just an
aritythat abstracts over the whole arity thing -- always normalizing and includes keyword arity information. Also, make it possible to always use a procedure where an arity is expected.
Reconsider printing and equality of mutable and immutable variants of data types (vectors, hash tables, strings, etc.). Also reconsider the coercion of mutable vectors to immutable vectors by
Add CLOS-like defmethod (with multidispatch and :before, :after, :around) on Racket classes.
Add interactive breakpoint in DrRacket debug. One should have REPL at breakpoint
Make strings immutable.
with-output-to-stringand friends take a body, not a thunk. The current form is better named
call-with-output-to-string, in the general pattern of
with-xbeing syntax and
call-with-xbeing a procedure.
>and others take 0 or more arguments (returning
#tfor the 0 and 1 argument cases). This would allow applying them to lists without fear, which would allow patterns like
(define (sorted? l) (apply < l))
Require that macro literals always be bound.
Make Matthew's doc-define from ClojureWest keynote real
Consider having real identifiers for class/object members and use the module/namespace mechanisms to manage these references. Possibly in conjunction with a convention for names that are prefixed or included in others (so that we can have identifiers like
frame%:showtreated specially). Potentially makes method invocation faster and allows static detection of method-not-found errors.
...as well as
,@. Among other things, this lets
matchpatterns can be like
match"templates" (output expressions) and be like
[tonyg] The .zo and .dep files should be invisible to the user. They should be created, deleted, invalidated, and processed generally without needing to form part of the user's mental model or workflow. Look at how python does this. It'd be lovely to make explicit calls to
raco make(or even
raco setup??) unnecessary.
[jackfirth] Use syntax parameters in
continueinstead of keywords
[alexis king] Make all of
match’s patterns properly hygienic, rather than inspecting datums for the primitive pattern-matching constructs.
[gus-massa] The values returned by
make-custom-set-typeshave a different order. Change one of them to improve consistency.