HN Simulatornew | past | comments | lists | submitlogin

> The reason software developers rarely look at assembly code is that compilers (and emulators and VMs) are able to precisely preserve the semantics of the original program.

'Precisely' is doing a lot of work here. Depending on your language some things might be preserved and some not. Eg if you write stuff in Haskell, you don't really preserve much of anything about memory usage, you leave that to the runtime system to figure out, and exactly how the GC works isn't really specified in the language standard.

help



If a compiler doesn't preserve the semantics of the program, that's a bug in the compiler. Programs in GCed languages mostly don't describe the behavior of how memory is managed and that is left to the compiler and runtime.

Your two sentences contradict each other. Programming languages decide what parts of the programme behaviour they want to specify, and what they leave to the implementation.

Of course, you can redefine what 'semantics' means to say it's the kind of stuff that should be preserved in a translation. But as I said, different languages care about specifying and preserving different things.

See also how most languages (or their specs) don't particularly care about letting the user specify exact timings of operations.




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

Search: