Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Prelude split into multiple files #133
Prelude split into multiple files #133
Changes from 1 commit
8d4f74c
04b7870
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
maybe we would want some unary operator for get? Ocaml's (! .) works fine for me but maybe there is a better one
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 thought about it. The nice thing about unary operator
(! .)
in OCaml is that it is a) short, and b) it has very high precedence (higher than application). I think a methodget
also has both of these advantages. Moreover, I see the two arguments against OCaml-like(! .)
:!
and!=
starts with the same character, but have very different precedence (see PR Fix!=
operator in lexer #125).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.
Since we are thinking of adding arrays, and there accessor to specyfic element of array is method
at
, maybe its a good idea to keep consistency and also name this methodat
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.
In arrays (#126) the
at
accessor is only for writing. Just to be able to write code likearr.at 42 := 13
. For reading we haveget
. I don't see how to define a single accessor for both reading and writing.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 think we will add more functionality to String module, and then i would expect to access that functionality with
import String
instead of having to writeimport /Base/String
in repl.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.
As I answered to
chr
issue, the purpose of/Base/String
is to have only some basic methods there. For other functions I would prefer to have a separateString
module.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.
as a user i would expect to see function like this in Char module, and also those modules are a good place to add any functions (not only methods) attached to these types, but not necessarily being dependent on any value of this type. Such as
chr
function.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 agree. However, I'm against moving it into
/Base/Char/
as the main purpose of this module is to contain methods that might be used without importingChar
explicitly. We should create a separate moduleChar
for that. I thing it can be done as a separate task.