farmer icon indicating copy to clipboard operation
farmer copied to clipboard

Define For method in arm {}

Open forki opened this issue 5 years ago • 16 comments
trafficstars

image

forki avatar Apr 11 '20 13:04 forki

Doing this would also remove the need for add_resources.

isaacabraham avatar Apr 11 '20 13:04 isaacabraham

I don't know if this is possible though - calling custom operations within a For method.

isaacabraham avatar Apr 11 '20 13:04 isaacabraham

If you do For, then also please do If

forki avatar Apr 12 '20 05:04 forki

Yes, you can call custom operations after a for method. This is how things like query expressions work. I’ve discussed it a bit here. Or I’ve misunderstood the question!

panesofglass avatar Apr 13 '20 13:04 panesofglass

@panesofglass ok, good to know it's possible :-) Is there any example you can point me to? I don't even know what the signature of For should look like, let alone how to hook it into the CE and update the internal state.

isaacabraham avatar Apr 13 '20 13:04 isaacabraham

Looks like you want an actual for loop, so you will need to do something like this, which requires additional members.

panesofglass avatar Apr 13 '20 13:04 panesofglass

Iirc, supporting if just means you have to implement Delay, and possibly Combine. However, sometimes mixing standard members with custom operations requires you wrap each in its own expression.

panesofglass avatar Apr 13 '20 13:04 panesofglass

isaacabraham avatar Apr 13 '20 13:04 isaacabraham

Let me know if you want to pair on this or need help.

panesofglass avatar Apr 14 '20 15:04 panesofglass

Yes and yes :-) Maybe wednesday?

isaacabraham avatar Apr 14 '20 16:04 isaacabraham

Doh! Looks like I missed the window. How about Friday morning? I'll be online early.

panesofglass avatar Apr 16 '20 17:04 panesofglass

@panesofglass I've enjoyed your CE workshop, found earlier by random googling. Thank you!

vilinski avatar Apr 17 '20 12:04 vilinski

Having chatted with @panesofglass, I don't think this will easily be possible. We could potentially yield within add_resources but I'm not sure what the use case or benefit that would justify the cost of doing this.

isaacabraham avatar May 10 '20 18:05 isaacabraham

I may still try this again. There should be some solution that should work here, though it may not be as lovely as you'd like.

panesofglass avatar May 12 '20 18:05 panesofglass

I don't see what value does it bring - generating resources outside of the CE is already possible, unless you somehow benefit from CE context (for example let! within if/for expression).

et1975 avatar Jun 10 '20 21:06 et1975

I think the main benefit might be that we wouldn't need to create single and collection versions of keywords e.g. add_secret and add_secrets.

isaacabraham avatar Jun 17 '20 08:06 isaacabraham

Closing due to inactivity

Tom-Sloboda avatar Jun 02 '23 09:06 Tom-Sloboda