4 ms·
Wow, interesting. The language has type coercion, and makes full use of it. I likey :D Thanks for the example too!
by i336_ 9y ago
Wow, interesting. The language has type coercion, and makes full use of it. I likey :D
Thanks for the example too!
- cestith 9y agoIt actually goes a bit beyond type coercion. Larry Wall is a linguist. The language is actually contextual. There's numeric vs. string context for scalars and scalar vs. list context for assignments and returns. The list of features is impressive, but taken together all at once can be daunting. I think that's why there's so much distaste for it in certain camps. It's actually possible in a function to test whether the caller wants a single value or a list and adjust your return accordingly. It has anonymous functions. It has closures. It has map() and sort(), either of which apply a custom block of code to a list. You can easily write user-supplied functions that do that, too. It has dictionaries / associative arrays (called "hashes" in the community since that's how they are implemented), regular arrays, scalar values, and a number of different object systems from which to choose.