Hacker News new | past | comments | ask | show | jobs | submit login

@arr pri fn [!_->empty:

uhm, beautiful




Depends 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 ;)


  [] 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.


But 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).


Beauty 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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: