Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

not sure exactly why the idea that it saves compile time is supposed to be surprising.

its obvious that you can make 'human friendly' (i don't agree with that at all) one based indexing into zero based indices at the compiler stage by doing a lot of -1's (because it makes sense for memory addressing - thats how memory addresses work). those -1s obviously cost something...

that it slows down run-time code is utterly unthinkable in the context of old school computing - whilst it might make sense today if you are using some high level tool built on piles and piles of other tools, and so far from the metal that you have no idea what is going on... even then i struggle to understand why this would be considered.

off loading run-time costs to compile time is standard optimisation practice... although it was massively more important in the past than it is now. the case from the story shows how language design optimised the compiler design, so that it would optimise the final run-time.

its just optimisation - any programmer assigned this task in this context is highly likely to come up with the same solution because its straightforward and works.



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

Search: