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

Does OCaml not have nested comments? Typically a language supporting /* */ will treat them like parentheses and require each opener to match a closer. (Not that this doesn't make documenting the behavior of files/static/* harder - hence Rust and C# preferring to document with line comments.)


OCaml has nested comments (and comments are also aware of string literals). Thus any fragments of valid OCaml code can be commented without changes. In other words, the whole line below is commented-out.

     (* let x = "*)" (* inner comment *)  *)


> Typically a language supporting /* */ will treat them like parentheses

This is not the case for C, C++ or JavaScript for a start.




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

Search: