Hacker Newsnew | past | comments | ask | show | jobs | submit | anders0's commentslogin

To nitpick, -14 isn't a literal in all languages. :)

(In Haskell, it's just sugar for negate 14, while in Standard ML it's spelt ~14. And I assume there are other exceptions too.)


Even in C it's not a literal. The consequence is that in a 32-bit implementation, you can't write INT_MIN as -2147483648 (-2^31), because 2147483648 would overflow a signed int. Instead a workaround such as -2147483647-1 must be used.


Making the minus part of the literal can lead to parsing ambiguity. For example, "x-3" would parse as 2 tokens "x" and "-3" (instead of 3 tokens "x", "-" and "3") which would be a syntax error in C. The only workaround I can think of is making any expression followed by a negative number parse as a subtraction.


> Making the minus part of the literal can lead to parsing ambiguity.

Not really. It's done in java. Usually, minus ("-") is parsed as a token and then unary minus on integer literals are transformed to a negative integer literal.

So, -2147483648 is read as MINUS INT_LITERAL and thus transformed into "-2147483648" as an INT_LITERAL, but -(2147483648) should be read as MINUS L_PAREN INT_LITERAL R_PAREN and should thus not be transformed.


Huh. I always assumed it was in C. Shows what I know… :p


I'm not saryant, but the school of CS at St Andrews (UK) briefly teaches us LaTeX in second(?) year, and encourages us to use it to write all our reports, essays, etc.

(OT: I also got complimented in high school for my physics coursework being typeset nicely. :D None of the other teachers seemed to really notice, though.)


Well, it's both.


They just happened to have a beer pint icon but no freedom icon.


But couldn't the language's runtime (or the GC library, or whatever) register for these notifications?


Yes, but my impression is that the set of conditions where this helps (you have memory pressure AND the runtime has lots of memory it can free up) is rather rare. If you have memory pressure, that's usually the same time that the runtime is actually trying to make use of lots of memory.

IIRC, Android provides something along these lines (as does Windows Phone 7.1), and when you get under memory pressure (common on Honeycomb-based tablets) you end up with thousands of these notifications, each freeing up 1KB or 2KB when you really need to free up tens of megabytes (which you can only do by serializing and terminating an application).


"non-(banana republic)", not "(non-banana) republic".


Then you have to write "non-banana-republic". "Non-banana republic" is not even ambiguous, it's just wrong.


It doesn’t if I use a tap-click on my trackpad either; it only seems to if you hold it down.

Do these actions (tap-click, screen touch) not send separate mouse{down,up} events? Because that might be related.


No love for `ZZ` here? :( (And its friend `ZQ`, which is the same as `:q!`.)


Apart from `-p` and `--name-status`, there’s also `--stat` for the `++++++++----` things for each file.


Well the revised syntax (http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html) is completely implemented as a camlp4 (p5?) extension, so if you have enough patience you can write another extension to replace the syntax with whatever you want, I suppose.


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

Search: