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
Draft: File Library for Coalton #1085
base: main
Are you sure you want to change the base?
Conversation
1fd1c2a
to
e43ce47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a more thorough look sometime this week
29aa228
to
70eb2bf
Compare
@eliaslfox I think this is at a point that it could be reviewed. Summary:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to finish the review
7df1a1b
to
d5a657a
Compare
Latest edit:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another pass. this is looking good
6552cc3
to
75fbdce
Compare
All prerequisite merge requests have been assimilated, tests added. Ready for near-final review |
(cl:format cl:nil "Captured Lisp Error:~%~%~a" c)))) | ||
((EOF) | ||
(error (lisp String () | ||
(cl:format cl:nil "Error:~%~%End of File")))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(error #.(cl:format cl:nil "..."))
you can format at read time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that that syntax would work instead of the whole lisp-coalton-bridge?
|
||
(coalton-toplevel | ||
|
||
(declare append-file ((Into :p Pathname) (Streamable :a) => :p -> (iter:Iterator :a) -> (Result FileError Unit))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append-to-file
(fn (stream) | ||
(write-sequence stream data)))) | ||
|
||
(declare supersede-file ((Into :p Pathname) (Streamable :a) => :p -> (iter:Iterator :a) -> (Result FileError Unit))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write-to-file
(fn (stream) | ||
(write-sequence stream data)))) | ||
|
||
(declare read-file-string ((Into :a Pathname) => :a -> (Result FileError String))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read-file-to-string
@@ -222,6 +222,16 @@ | |||
(:export | |||
#:Iterator) | |||
|
|||
(:import-from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't put file stuff in the prelude.
@@ -6,7 +6,25 @@ | |||
(:export | |||
#:gc | |||
#:time | |||
#:sleep)) | |||
#:sleep) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the system changes go in another pr?
First draft of an IO library for Coalton. This allows for directory navigation, environmental/system information gathering, and simple file-reading.
This mostly repurposes
UIOP
andASDF
functions, with an intent to make things simple/streamlined without as much unfettered, lispy freedom. I'm focusing on what most users will need for most use-cases, as fringe edge cases can be hand-rolled with lisp.The current working directory can be accessed with
(cwd)
and set with(chdir dir)
, with most file functions automatically operating in the context of the working directory. Note: This distinction is important because UIOP allows you to set the current working directory, but the default directory for operations is still the home directory.Next steps, open thoughts:
current-working-directory
, or at least acurrent-system-directory
when loading a coaltonproject.asd
orpackage.lisp
.