I'm having way too much fun with #kotlin letting me name functions with free text :D
Post
I'm having way too much fun with #kotlin letting me name functions with free text :D
@konstantin lol in my brief stint as a full time Kotlin dev our team did exactly this for tests lol
@ianthetechie haha, sounds like fun :D
@konstantin @ianthetechie in every meetup, the Kotlin folks rave about this being a thing. I believe they all do that!
(I'm really happy that we have this in Swift now, too)
@ctietze @ianthetechie Now, we can be chaos in every language 🚀😁!
@konstantin swift has this too now FYI (since 6.2): https://useyourloaf.com/blog/swift-raw-identifiers/
@nicklockwood Ohhh that's amazing. I'm so going make proper (over)use of it 😁
@konstantin interesting. You can do the same in Tcl (indeed a procedure name could even be some binary data). Additionally you can have aliases, so you could indeed use that pattern you describe to have a rich explanation of function as the original name, and then an alias for actual use.
@Setok Oh really, that sounds cool. I guess writing tests is really the perfect use case for this, it's not a function you'd need to call or type by hand. It can get cumbersome in other use cases
@konstantin can also be used for encapsulation of a sort. At least in #Tcl, procedures (functions) can be created dynamically and with any names. So you could have a procedure that creates a new procedure (even like what you described), and returns the name which you could then set to a variable and use it that way (indeed OO systems tend to do that). Using aliases you could even create a command to do:
newProc hello {Does the usual hello world thing} {
puts “Hello, world”
}
@konstantin that newProc would create a proc with the name given in the description, and then create an alias to it (‘hello’ in this case).
Endless possibilities :)
A space for Bonfire maintainers and contributors to communicate