Replies: 3 comments
-
Given how limited this is, only a single argument, and being unable to call functions that have more than one argument, this seems a very roundabout way to do the same thing, and I don't think it provides any more readability |
Beta Was this translation helpful? Give feedback.
-
It doesn't have to be exactly like elixir. The hack programming language doesn't forbid multiple arguments. We can have a symbol that denotes where the argument gets inserted (kind of like format strings). It can also be used in constructors and array indexing or anything like that get_something() |> is_equal_approx(%, 0.0)
var vec = get_something() |> Vector2(10.0, %)
var element = get_index() |> array[%] |
Beta Was this translation helpful? Give feedback.
-
I like the idea, since in functional programming it is used a lot. Sure if you don't write in functional programming style you may find it not useful but people who write stuff in that style, it is very useful. Furthermore, you can store the new composed lambda function in a variable and call that function with any data you want. |
Beta Was this translation helpful? Give feedback.
-
I think a pipe operator in gdscript could greatly improve readability of code. For those who don't know, the pipe operator allows you to pass the return value of a function as an argument to another function, something like this:
Imo this is way cleaner and I think gdscript being focused on simplicity as a scripting language can benefit from something like this.
Piping multiple values into a function is forbidden in languages like elixir:
Curios if anybody else might find this useful
Beta Was this translation helpful? Give feedback.
All reactions