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

In OCaml I think this could only happen with the interpreter (e.g., an interactive toplevel). At least today the compiler complains if you try to define two types with the same name in the same context.

The problem is that it would happen often in the interpreter when you were interactively trying stuff out, because when you're trying stuff out, you change the definitions of things.

Python actually sort of has the same problem not only when you use an interactive interpreter but even when you reload a module: the new class definitions don't modify the old one, they just get bound to the same name. So it's easy to end up with two alglayout.Vbox classes or two diff.Formula classes in the same interactive interpreter at the same time. But it's much less of a problem in Python because Python usually doesn't care what class things are, just what methods they define, so objects belonging to both classes can coexist peacefully. The usual exception is when you have an isinstance check somewhere.



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

Search: