Skip to content
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

How to properly filter an Enumerator? (onchain filter on stackitem Enumerator) #914

Closed
igormcoelho opened this issue Jul 12, 2019 · 4 comments
Labels
design Issue state - Feature accepted but the solution requires a design before being implemented feature Type: Large changes or new features vm New features that affect the Neo Virtual Machine or the Interop layer

Comments

@igormcoelho
Copy link
Contributor

igormcoelho commented Jul 12, 2019

This appeared here: #877 and on NFT discussions, and many places else...

Suppose I have an Enumerator stack item:

Enumerator e = GetEnumerator();

How can I filter it? My first thought went back to OPEVAL discussions, but perhaps we need something less dangerous and already existing on neovm... delegates?

Enumerator e2 = e.Filter(x => hasProperty());

Could we pass this property to bool function as a delegate on C#? @lightszero @erikzhang @lock9 @shargon

Perhaps this could generate something like:
System.Enumerator.Filter [parameter method position in code]

example (draft):

delegate filterfunc(x) : int -> bool = x > 5; // don't know how to write it...

Enumerator e;
e.Filter(filterfunc);
// filterfunc is compiled to position 0001

System.Enumerator.Filter 0001

@lock9 lock9 added the discussion Initial issue state - proposed but not yet accepted label Jul 13, 2019
@igormcoelho
Copy link
Contributor Author

Agree with @shargon, json is very useful in.this context.

@lock9
Copy link
Contributor

lock9 commented Jul 15, 2019

Is this a duplicate of #880 ? Do you want to close this and continue only in #880 ?

@igormcoelho igormcoelho changed the title How to properly filter an Enumerator? How to properly filter an Enumerator? (onchain filter on stackitem Enumerator) Jul 19, 2019
@lock9 lock9 added design Issue state - Feature accepted but the solution requires a design before being implemented feature Type: Large changes or new features vm New features that affect the Neo Virtual Machine or the Interop layer and removed discussion Initial issue state - proposed but not yet accepted labels Aug 10, 2019
@igormcoelho
Copy link
Contributor Author

@erikzhang I'll reopen this.

Now we can finally do it, using neo-project/neo-vm#190

@igormcoelho igormcoelho reopened this Dec 6, 2019
@erikzhang
Copy link
Member

No, you can't use it for data filtering. Because it cannot be passed to other contracts. So we need #284. That's why I close this.

Thacryba pushed a commit to simplitech/neo that referenced this issue Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Issue state - Feature accepted but the solution requires a design before being implemented feature Type: Large changes or new features vm New features that affect the Neo Virtual Machine or the Interop layer
Projects
None yet
Development

No branches or pull requests

3 participants