-
Notifications
You must be signed in to change notification settings - Fork 323
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
Adding type annotations and enabling auto-scoping #10173
Conversation
24ba0b9
to
90d67cc
Compare
@@ -22,25 +23,25 @@ polyglot java import org.enso.base.Regex_Utils | |||
|
|||
type Filter_Condition | |||
## Is less than a value (or another column, in case of Table operations)? | |||
Less than:Any action:Filter_Action=Filter_Action.Keep | |||
Less than:Any=(Missing_Argument.throw "than") action:Filter_Action=Filter_Action.Keep |
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.
Why use throw
over ensure_present
?
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.
didn't want the stack location etc - just the bare minimum error for now.
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.
The source location was not being displayed anyway.
IMHO ensure_present
has the nice advantage that it shows which function this argument belongs to (unless that's broken?). Then it makes it easier to localize where the missing thing is in a big expression (e.g. a join with many parameters).
But OK to just keep simple for now if you think that's better, we can always change in the future.
@@ -21,6 +21,7 @@ type Case_Sensitivity | |||
|
|||
Arguments: | |||
- locale: The locale used for the comparison. | |||
@locale Locale.default_widget |
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.
Is this a defect somewhere else that you need to add this?
predicate : Function -> handle_constructor_missing_arguments predicate predicate | ||
predicate : Function -> predicate | ||
element -> (== element) | ||
|
||
## PRIVATE | ||
Checks if the given `function` is actually a `Filter_Condition` constructor | ||
that is just missing arguments. If so, it will report a more friendly error. | ||
Otherwise it will run the `continuation`. | ||
handle_constructor_missing_arguments function ~continuation = |
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.
Good that we no longer need this :)
distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Common.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Table_Helpers.enso
Outdated
Show resolved
Hide resolved
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.
Looks great, just a few small comments.
The Missing_Argument
trick is really really awesome, it finally makes it so that we don't get some weird internal errors for 'half done' nodes but instead we get a clear message about a missing argument. This is really a great pattern that I hope we will use.
266ea2d
to
9278fbc
Compare
8efd872
to
4342405
Compare
@@ -22,25 +24,25 @@ polyglot java import org.enso.base.Regex_Utils | |||
|
|||
type Filter_Condition | |||
## Is less than a value (or another column, in case of Table operations)? | |||
Less than:Any action:Filter_Action=Filter_Action.Keep | |||
Less than=(Missing_Argument.throw "than") action:Filter_Action=Filter_Action.Keep |
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.
- Is this still needed after merge of Execute foreign function and check autoscoped constructor result #10187 ? The message is composed at
_ -> ". Try to apply " + (missing_args.join ", ") + " arguments" |
feel free to reformulate the sentece anyway you want.
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.
Will try this in the next PR and if it works switch to then.
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.
Hello @jdunkerley, does the
approach work for you? Can it be used instead of `Missing_Argument.throw "than", please? CCing @GregoryTravis
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 this is the best solution now because it requires no changes to Numbers.enso type signatures. It adds a special case to the error class but that seems acceptable.
|
||
## PRIVATE | ||
Resolves a possibly auto-scoped value to a concrete value. | ||
resolve_auto_scoped : Any -> Any |
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.
Please use private
keyword.
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't in this case as used across different libraries but yes will do.
1e14a09
to
df74d11
Compare
Pull Request Description
Missing_Required_Argument
toMissing_Argument
, and addedthrow
method.Case_Sensitivity.Insensitive locale
.parse_type_selector
.Table
andDB_Table
.Filter_Condition
to haveMissing_Argument
for all non-defaulted arguments.Column_Ref
passed as auto-scoped toTable_Ref
.Simple_Calculation
to haveMissing_Argument
for all non-defaulted arguments.Join_Condition
to haveMissing_Argument
for all non-defaulted arguments.Sort_Column
to haveMissing_Argument
for all non-defaulted arguments.Aggregate_Column
to haveMissing_Argument
for all non-defaulted arguments.rename_columns:
aggregate:
join:
set:
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.