source: project/wiki/chicken-5-roadmap @ 33250

Last change on this file since 33250 was 33250, checked in by svnwiki, 6 years ago

Anonymous wiki edit for IP [151.45.217.41]:

File size: 19.8 KB
Line 
1== CHICKEN 5 roadmap
2
3[[toc:]]
4
5Here's a proposed list of things we would like to see in CHICKEN 5.
6Feel free to add more details if you know of a way to implement
7something or have an idea how to improve some part.  Please, no
8editing flamewars here!
9
10=== Modularising the compiler [done]
11
12This work has been completed: the compiler now is composed of modules
13in the {{chicken-5}} branch (prefixed with {{chicken.compiler}}), but
14the following "nice to haves" are not yet implemented:
15
16* Define an "official API" for users of the compiler.  Basically everything that's currently being done through ugly {{##compiler#}} hacks should have a supported, documented way to do it.  Later, we can expose more features.
17** Hooks for adding new foreign types. Used by {{bind}}.
18** Hooks for adding new compiler literals?  Examples of this are the CHICKEN 4 {{numbers}} egg or when we want to turn srfi-4 into an egg.
19** Some standard way to determine the current source file (ideally this would be a library procedure which works the same way in compiled and evaluated code).  Used for things like the {{s48-modules}} egg.
20** Perhaps a way to define new compilation stages.
21
22These should be considered after CHICKEN 5 is released.  Of course, if
23you want to tackle one of these before, feel free to submit a patch.
24
25=== Reworking the core modules ("units")
26
27Right now the modules supplied by core are somewhat arbitrarily named,
28and too many unrelated things are grouped together.  We should go
29through the system and look at what we have, then make logical names.
30Suggestion appear [[#proposed-libraries-incomplete|later on this
31page]], for further discussion.  We should attempt to align it with
32the r7rs naming conventions, to make things easy for that egg, and for
33people new to CHICKEN but familiar with other r7rs implementations.
34This probably means "scheme" should be renamed and split up to
35"scheme.base", "scheme.load", etc.  A possible generalisation (or
36"convenience hack") could be to define the "scheme" module to import
37all of the underlying submodules.
38
39* As I've posted to the mailing list, I think using hyphen makes more sense than using dot.  --John Cowan
40** I think we're pretty much resolved to using dots, for various reasons appearing on the list (and because there's momentum in the other direction with e.g. the compiler modules). -- eh
41
42==== Replacing SRFI-14 with cset implementation from irregex? [irrelevant]
43
44This has been discussed ages ago.  It might be more memory-friendly
45and performant.  One problem with the current SRFI-14 module is that
46it assumes Latin1 encoding (and therefore can only handle 256
47different characters), whereas most other CHICKEN components and eggs
48assume UTF-8.
49
50* Strong +1.  --John Cowan
51* Note that in the "Proposed removal from core" section below, srfi-14 is proposed to be removed from the core. --mario
52
53This is not needed, because SRFI-14 is no longer part of core.  The
54egg could still benefit from it, but it's not something that will hold
55up the CHICKEN 5 release.
56
57
58==== Refactoring the CHICKEN test suite to use a core library? [status uncertain]
59
60As we remove a lot of cruft from core which it doesn't need, it may be
61a good idea to add some things that we ''do'' need.  Like the {{test}}
62egg: there is a lot of macro code duplication in core's test suite.
63It's probably better to ship a well-designed testing library with
64core, which core itself can also use.  This would make it easier, if
65we decide to do this later, to format test output on Salmonella in a
66consistent manner for both core and eggs.
67
68* That could even be done for CHICKEN 4, since it wouldn't break anything. -- mario
69
70==== Proposed libraries [incomplete]
71
72Refer to the concrete reorganization plan [[/core-libraries-reorganization|here]].
73
74What will we do with the SRFIs we implement?  It would make sense to
75define the following, but it would be tedious to import all these:
76
77; srfi-2 : and-let*
78; srfi-8 : receive
79; srfi-31 : rec
80; srfi-26 : cut, cute
81; srfi-17 : setter, getter-with-setter
82; srfi-10 : define-reader-ctor
83; srfi-39 : parameter objects
84
85* I'm planning to propose some of these (2, 8, 31, 26, 17) in a single R7RS-large library, probably called (scheme control) or (scheme control simple).  --John Cowan
86** Since this hasn't been standardised yet, and for improved compatibility and consistency with other Schemes, it's probably a good idea to define them as separate modules anyway.  Note that this does not preclude re-exporting them elsewhere as well. --Peter Bex
87*** I agree that they should be defined in their own modules and then reexported by some larger modules, e.g. some {{chicken}} library includes {{and-let*}}, etc. -- eh
88
89Also, is it {{srfi-2}} or {{srfi.2}}?  The latter would match up with
90{{(srfi 2)}} usage which is reserved by R7RS for SRFIs.
91
92* If we get rid of dots, then it's just {{srfi-2}} without special-casing it as the R7RS egg apparently does right now.
93** I think we should just support both. -- eh
94
95* If you put {{use}} in a module, how do you get access to that module?  I favor the R7RS solution, in which {{import}} does what Chicken {{use}} does, and is special-cased in terms of the module system so that it is always available.  --John Cowan
96** Right now, I think the module import/export forms are always available inside a module form.  This is no different from special-casing it, I think (unless I'm misunderstanding something). --Peter Bex
97
98* There will be R7RS (scheme fixnum) and (scheme flonum) modules.  I'm currently proposing to base the fixnums on R6RS and the flonums on {{math.h}} (not the egg of that name, but the whole C interface).  --John Cowan
99** That sounds like they'll be somewhat different from the list of identifiers we have.  And it will take a while before it's finalized I guess, so it's safer to define our own and later add the r7rs versions if we deem it acceptable. --Peter Bex
100
101==== Proposed removal from core
102
103The list below is just one hacker's idea of what could go.  Please add more.
104
105===== SRFIs [done]
106
107SRFI-1, SRFI-13, SRFI-14, SRFI-18 might be removed. SRFI-69 will be
108removed, as discussed in CR #1142.
109
110As pointed out several times by John Cowan, SRFI-15 (fluid-let) is
111unsafe in the presence of threads, and any use is most likely broken
112and should be replaced with R7RS/SRFI-39 parameters.  Currently, core
113uses it in a few places, in a possibly dangerous way.
114
115Most importantly, there is no reason it has to be in core, because it
116uses only basic primitives.  I think it's best to delegate it to an
117egg.
118
119* On second consideration, I don't think it is worth "fixing" SRFI-15 like that -- sjamaan
120
121===== queue datatype (data-structures), binary-search (data-structures), mmapped files (posix), object-evict (lolevel) [done]
122
123Proposal already accepted in CR #1142.
124
125* I'm proposing a queue library for R7RS-large.  --John Cowan
126** It would be great if it could be inspired by CHICKEN's, but that's not strictly necessary, as there is plenty of room for multiple queue eggs --Peter Bex
127
128===== combinators [status uncertain]
129
130Some of the combinators from data-structures are very nice, but there
131only a handful of them are actually useful.  There is no technical
132reason to keep them in core, they might fit better in an egg.
133
134* I'm proposing a similar library for R7RS-large.  --John Cowan
135** Maybe we can rip it out of core and wait for R7RS before implementing the egg. --Peter Bex
136
137===== Various ill-conceived POSIX things [status uncertain]
138
139These things I don't like, but doesn't mean it *has* to go.  It may
140always be put in an egg of course.
141
142* file-select (but see the section about refactoring the scheduler!)
143* file-control (no need to be in core)
144* file-mkstemp (too tricky to use properly? maybe a different API)
145* file-read and file-write (too low-level)
146* file-stat (might be changed return a record type?)
147* set-file-position! (see the section on I/O refactoring)
148* All the time stuff.  It's too broken/difficult to use, and might be better off in an egg.  Core uses some of it, so we may need to reconsider and just improve the API.
149* terminal-name, terminal-port?, terminal-size (but chicken-status uses it!)
150* The process-stuff.  There are too many procedures which is confusing.  Boil it down to just one or two essential ones.  Possibly make a "fork&exec" implementation, which maps better to the Windows model, and still works fine on UNIX.
151
152===== Better API for continuations [status uncertain]
153
154Nobody seems to use the "better API for continuations" by Feeley:
155continuation-graft, continuation-capture, continuation-return,
156continuation?
157
158If it doesn't benefit anyone (core doesn't use it, only two eggs do:
159shift-reset and continuations), it can be taken out.  It might be put
160into an egg.
161
162* +1 for an egg.  I'm going to propose this for R7RS-large.  --John Cowan
163
164* FWIW this seems to be pretty deeply-seated in core/runtime.c (to me at least!) -- eh
165
166=== Reworking the way libraries are loaded [incomplete]
167
168Right now there are just too many confusing things, like require, require-extension, use, import, load, load-library, require-library.
169
170* Import (with the function of use) should be the main API.  Load is necessary because it can load things whose names are determined at run time.  It should be able to load either source or binaries.   Include also belongs here.  --John Cowan
171
172Units and modules are confusing also.  This could just be a
173documentation issue.
174
175* Units should IMO be deprecated, with a compiler switch to turn off deprecation when compiling Chicken itself.  --John Cowan
176** I disagree: there's no reason why core should be "special" in any way.  We could de-emphasize their importance in the manual, instead. --Peter Bex
177
178* I disagree that units should be deprecated at all. I agree that import should be the primary API, with an alternative form for importing just identifiers (perhaps even {{(import-identifiers (foo bar))}}). -- eh
179
180==== Make the library load path a search path [incomplete]
181
182This keeps cropping up on IRC: people expect to be able to load libraries from their eggs using a search path containing multiple entries. This would allow you to {{(use ...)}} a module from your application without installing it as an egg.
183
184This is rather tricky: what happens when you compile it and install the whole program into some other location? Also, changing the way it's implemented is nontrivial, as it has been attempted before (see [[http://bugs.call-cc.org/ticket/736|#736]]).
185
186==== Standardize import path behaviour
187
188Currently, import files are loaded from a different conceptual path than extensions, which use a different path than include files, and so on. We should standardize this behaviour, and allow the user to use multiple directories as the path.
189
190It would also be nice for {{include}} to push the including file's directory onto the include path during expansion.
191
192=== Refactoring the scheduler [incomplete]
193
194One missing ability in the scheduler is for threads to block on more
195than one object.  This would allow us to generalise {{file-select}} to
196ports.
197
198=== Refactoring the I/O (ports) system [incomplete]
199
200Currently, ports are somewhat ill-defined: they're a hand-coded record
201type with a bunch of slots, with comments indicating which slot is
202used for what.  It would be cleaner and easier to understand the code
203if this was changed to a "proper" record type.
204
205The {{current-*-port}} identifiers should be rewritten to be proper
206parameters instead of fake ones which are rebound through fluid-let.
207
208Recently I discovered that set-file-position! does not work on string
209ports.  Port position should be part of the official interface, so
210that this is extensible, and if a port implements it, it can be
211rewound.  This makes sense at least for file-backed ports and string
212ports.
213
214* Well, not all file-backed ports are seekable.  --John Cowan
215** That's okay; they can throw a "not implemented" exception. --Peter Bex
216
217This is also a good opportunity to look at why I/O is so slow.
218
219One small improvement I'd like to make is to change write-string to
220accept an offset into the string from which to write.  This would mean
221writing substrings does not have the overhead of first having to copy
222the substring to a new string and '''then''' writing it.  I ran into
223this once and I thought it was a shame, because it's such a trivial
224(but incompatible) modification.
225
226=== Integrating the full numeric tower [done]
227
228This work has been completed: full support for the complete numeric
229tower is available in the {{chicken-5}} branch.  This includes support
230for literals in compiled code as well as full integration with the
231FFI.
232
233=== String encoding [status uncertain]
234
235==== Reject all NUL bytes
236
237If we reject all NUL bytes inside strings, we can encode strings more conveniently
238by adding a NUL terminator to all strings (nothing else changes).  If we do this,
239the FFI does not need to copy strings, which makes it much more lightweight.
240
241Things to look into:
242
243* What if the foreign code mutates the string and inserts a NUL?
244* How do we deal with the length?  Currently the internal operation is ##sys#size, which simply unmasks and returns the string's header.  The GC knows about this general principle.  By adding the NUL byte, we add another special case to the GC.  This is ugly and complicated.
245* Possibly the operations we support on blobs need to be extended, so that all current abuse cases for strings can be handled by blobs.
246
247==== Unicode
248
249This at least needs some additional thought.  Do we want to make UTF-8
250the "official" encoding?  If so, ideally, all string operations should
251reject invalidly encoded byte sequences (should we still allow NUL
252bytes to be represented?).  What to do with the Unicode case folding
253lookup tables, string-ref?
254
255* Go full Unicode.  If Chibi can do it, so can we.  R7RS is factored to push the big Unicode tables into (scheme char).  However, IMO the NUL character is completely worthless as a character: it has no semantics worth mentioning.  We can forbid it in strings, as R7RS-small allows.  --John Cowan
256** Seems sensible. --Peter Bex
257* The approach used by [[http://caml.inria.fr/pub/ml-archives/caml-list/2002/08/e109df224ff0150b302033e2002dbf87.en.html|OCaml]] is quite smart and provides the best of both worlds (NUL terminated strings with a length tag used everywhere else but the FFI) at a negligible (IMO) cost. -- LemonBoy
258
259If we go full Unicode, the SRFI-4/blob types might need some
260attention, because strings can no longer be (ab)used as byte vectors.
261
262* Why are there both u8vectors and blobs?  IMO they should be the same thing, and should be R7RS bytevectors.  I'm working on a R7RS-large numeric vector library that allows either SRFI 4 style (separate data types for different kinds) or the style used in later SRFIs and R6RS (everything is just a view on top of bytevectors).  --John Cowan
263** u8vectors are less "core" than blobs (which is a consequence of the low-level representation).  In fact, we might be able to take srfi-4 out of core. --Peter Bex
264
265=== Improve the egg system [incomplete]
266
267Since this is a rather comprehensive point, there is now a
268[[chicken-5-roadmap-egg-system|separate document for it]].
269
270=== Changes to set! [incomplete]
271
272==== Make set!'ing of unbound variables an error
273
274R7RS recommends making this an error for modules but allowing it in the REPL.
275
276* We already check for renaming already bound identifiers, maybe that's not so hard after all. I will investigate this --Christian Kellermann
277
278==== Make set!-ing of module-defined identifiers an error
279
280Make identifiers imported from modules un-set!-able, for both core and
281user-defined modules. {{set!}} on such identifiers should raise an
282error, whereas {{define}} should define a new variable (in the current
283module's namespace, if there is one).
284
285=== Determine how to make CHICKEN 4 eggs live alongside CHICKEN 5 eggs [incomplete]
286
287Currently, "THE SYSTEM" does not have any special considerations for
288the major CHICKEN release used.  This could be considered an
289oversight.  To make it possible to continue using CHICKEN 4 eggs while
290CHICKEN 5 is being developed and matured, there needs to be some sort
291of way to do this.
292
293Currently, we have the master list of available eggs, which lives in
294the svn repo.  THE SYSTEM is extremely simple and doesn't really care
295much about how eggs are supplied, so we could just fire up a second
296instance of henrietta-cache which fetches from a ''different'' master
297list containing the CHICKEN 5 eggs.  However, what can we do to make
298life easier for egg maintainers?
299
300The official CHICKEN egg repo (SVN) already has taken care of this due
301to the {{/release/N}} namespacing.  The thing that needs to be changed
302is the location of the henrietta CGI, to include a version number, or
303we could add an extra URL parameter and teach it about the versions.
304
305For user repos, a simple way is to simply start a second repository
306and call it a day.  However, this will probably result in awkward
307names.  Making a new branch results in the same problem: the master
308branch would correspond to an outdated release!
309
310==== The simplest approach: just carry on
311
312Just continuing in the old repository for each egg is possible,
313if no new releases need to be tagged for the old CHICKEN release.
314This mostly precludes emergency bugfix releases, but these could be
315continued on a different branch (release-info only takes into
316account tarballs which get generated from a tag name, after all!).
317
318To prevent version tag clashes, the egg's major version should be
319bumped for CHICKEN 5.  Let's take for example an egg which has
320released 1.0, 1.2 and 1.3 for CHICKEN 4.  If we bump the major
321version, we can release 2.0, 2.1, etc for CHICKEN 5.  If an important
322bugfix needs to be made for the CHICKEN 4 version, we can continue
323with 1.4.  If we don't bump the major version, the egg would be forced
324to use micro version numbers for those, like 1.3.1.  Both approaches
325are fine, depending on how much effort is expected to be put into the
326"old" branch.
327
328The old release-info file will be untouched and continue to be used by
329the CHICKEN 4 version of Henrietta-cache.  For CHICKEN 5, a new file
330is made (ie myegg.chicken-5.release-info) which starts out empty, and
331as new releases are made will continue with the number where the
332CHICKEN 4 branch left off.
333
334==== Rework each egg's release namespace
335
336Another, possibly cleaner, approach is the following:
337
338* When an egg is ported to CHICKEN 5, rename or copy all existing tags,
339prefixing them like {{chicken-4/1.2}}, for example.
340* Make a chicken-4 branch from master and update the release-info
341file's location in the master egg list for CHICKEN 4.
342* Clear the release-info file in master, and submit its location for
343inclusion in the master egg list for CHICKEN 5.
344
345This way, new eggs and old eggs will ''always'' have the master branch
346point to the active version.  It does mean a little bit more work on
347every major release.
348
349To avoid having to clear the release-info file every time, we could
350also extend it to include a major release version number (and if it's
351missing, assume "4"?).  This means the release-info file would list
352both CHICKEN 4 and CHICKEN 5 (and later CHICKEN 6) releases in the
353same file.  This might make maintenance a little easier, but requires
354a small change in henrietta-cache.
355
356* IMO the brains should be in the henrietta web API.  --John Cowan
357** I don't think that's necessary.  In any case, there '''must''' be some way for the egg authors to indicate for which CHICKEN version the egg is. --Peter Bex
358
359=== Check if it is possible to have both CHICKEN 4 and CHICKEN 5 installed system-wide [incomplete]
360
361Maybe the current build system allows that (better check).
362During the transition period, it would be nice to allow
363users (and packagers!) to have both CHICKEN 4 and CHICKEN 5
364installed system-wide on the same system.
365
366Basically, we'd need to take the major version into account when
367naming things (binaries, runtime library and local egg repo).
368E.g., {{csc5}}, {{csi5}}, {{libchicken5.so.<binversion>}},
369{{lib/chicken5/<binversion>}}.
370
371The hardcoded path part ({{lib/chicken}}) in
372{{##sys#repository-path}} makes me (mario) believe it's not
373possible, but I may be missing something.
Note: See TracBrowser for help on using the repository browser.