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

While I don't rail against this kind of thing instinctively, I really do have to ask, is:

  pri fn render_row(row)
really that much better than

  private function render_row($row) {

?



I get abbreviating function to fn since the import part is the name, it is very common, and a lot of languages do it. I think abbreviating private is a mistake. It is important in itself and should have attention called to it.


I completely agree, will change all the pri, pub, arr, etc. to private, public, array, etc.


Speaking of readability: Just `pri` as the constructor? When having just a quick glance at code I want to know which part does what. Function names help, even if it is __construct.

And the @str title=null line above the class seems very odd.


pri's not a constructor in this language's terms, it's just a visibility operator. The language wants you to be able to use code in your class member assignment statements; if that means it has to generate a constructor to make it happen, it will. Or maybe it just wants you to start coding without fussing with boilerplate.

And the @str title=null line above the class seems very odd.

This is great because you can indent code under it that's relevant to it, that would normally end up cluttering your function's narrative up with housekeeping for variables.

This is a much more pleasant way to deal with PHP. Check out the documentation, it is outstanding. http://code.google.com/p/php-snow/wiki/Class


I'm not sure I understand your comment - the function name in this case is "render_row()", and "pri" refers to the visibility of the function.

I don't feel that it's more readable, or even easier to write, as "pri", though.


pri is used first for the constructor (right after class SumTable) but not followed by any name. I find it quite hard to read this way.


Ah - I missed that entirely, thanks for pointing it out again. That line may just win the prize for least-clear line in the Snow example.


I thought it was a typeo




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

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

Search: