4 ms·
@arr pri fn [!_->empty: uhm, beautiful
by zalew 15y ago
@arr pri fn [!_->empty:
uhm, beautiful
- ma2rten 15y agoBeauty is in the eye of the beholder. In mine it look a little bit odd as well, but I could imagine that it's better than PHP if you are used to it.
- viraptor 15y agoDepends on the languages you're familiar with... fn is common in some areas, _ is a popular "default variable", -> I see as an interesting addition although it would be equivalent to empty(_). What I'm not sure about is @arr (why not @array?) and [] instead of {} for a map... I'm not sure if it's beautiful, but it's definitely an interesting shortcut for common operations and I could immediately see why it's useful and already remember the syntax for it. I like it and the author seems to like it too, not everyone has to agree of course ;)
- deleted 15y ago[deleted]
- andypants 15y ago[] instead of {} for a map PHP uses [] for both list and map types. I don't think there's any difference between the two types in PHP. All lists are maps.
- daeken 15y agoBut we're talking syntax, not behavior. There's no reason they couldn't use {} to indicate maps and [] to indicate lists, even if they're the same data type. The point of this language is to be a cleaner syntax on top of PHP, so syntactical sugar like that is a Good Thing (TM).