-
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
Meta.get_annotation and extension methods #7000
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5fded8b
Multiple modules to verify Meta.get_annotation and extension methods
JaroslavTulach 4100e7e
Meta_Spec cannot see the method while Meta_Define_Usage can
JaroslavTulach 67fb583
Pass fn as a handle and query its annotations from anywhere
JaroslavTulach 5d87c9c
Special Meta.Function to work as a handle to Function
JaroslavTulach 133ba8d
Removing Meta.is_checks and adding Meta.meta_builtin factory
JaroslavTulach 83152a8
Resolve the function as soon as possible and only then pass it thru s…
JaroslavTulach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import project.Semantic.Meta_Define_Type.Meta_Spec_Type | ||
|
||
|
||
@which (self -> self.b + self.a) | ||
Meta_Spec_Type.describe_better self which = case which of | ||
"mul" -> self.a * self.b | ||
_ -> self.a / self.b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Meta_Spec_Type | ||
Value a b | ||
|
||
@which (self -> self.a+self.b) | ||
describe self which="first" = case which of | ||
"first" -> self.a | ||
_ -> self.b | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from Standard.Base import Meta, Nothing | ||
import project.Semantic.Meta_Define_Type.Meta_Spec_Type | ||
import project.Semantic.Meta_Define_Extensions | ||
|
||
call_describe_better it = it.describe_better | ||
annotate_describe_better it = Meta.get_annotation it "describe_better" "which" | ||
obtain_describe_better it = | ||
fn = it.describe_better... | ||
anno = Meta.get_annotation fn... Nothing "which" | ||
anno.is_nothing | ||
fn... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
This is very "verbose", @jdunkerley! One has to:
@which (self -> self.a)
as annotationMeta.get_annotation
I was hoping
Meta.get_annotation
actually invokes the code in@which self.a
by itself internally! E.g. one could referenceself
in the code after@which
and it evaluation would happen by itself too.With the current state of affairs, there is no reason why
Meta.get_annotation
shall takeself
argument! It rather needs aFunction
!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.
67fb583 let's anyone "resolve" a function and then pass such function as a handle around. Then everyone can query for annotations associated with that 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.
Agree on the
get_annotation
having to unwind to get the value is annoying.I wrapped it in the visualization layer and haven't thought of it since!