You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found myself wishing to be able to call procedures inside a function today. My use case was to set up the arguments of an assert I planned to run in many different variations. I wanted to test mys implementation of human against the existing one and thought I'd write something like the following:
I think it would be very beneficial for testing if something like the first line at least was possible. The second line is probably a lot more involved, so I won't focus too much on it.
I imagine it might be difficult or undesirable to mix functions and procedures, in which case I would instead propose to introduce custom procedures, a function-like construct that can only call other procedures.
The text was updated successfully, but these errors were encountered:
I found myself wishing to be able to call procedures inside a function today.
Yes, I can understand the pain. I also wanted something like this in the past.
On the other hand, that would complicate the language / type system a lot, I'm afraid. For now, function bodys are simply expressions. With your suggestion, we would allow (arbitrary) statements in the function body.
I imagine it might be difficult or undesirable to mix functions and procedures
Right.
in which case I would instead propose to introduce custom procedures, a function-like construct that can only call other procedures.
I didn't even think about what I described in the end was basically just a macro. I would love for numbat to have a good macro system, but I think it takes quite a bit more thought than I originally imagined.
For now, should I change the title and update the description to reflect that the issue will be about implementing macros?
I found myself wishing to be able to call procedures inside a function today. My use case was to set up the arguments of an assert I planned to run in many different variations. I wanted to test mys implementation of human against the existing one and thought I'd write something like the following:
I think it would be very beneficial for testing if something like the first line at least was possible. The second line is probably a lot more involved, so I won't focus too much on it.
I imagine it might be difficult or undesirable to mix functions and procedures, in which case I would instead propose to introduce custom procedures, a function-like construct that can only call other procedures.
The text was updated successfully, but these errors were encountered: