9 ms·
Duck typing means lots of things. I've replaced it with something which I think is more representative of what I was trying to evoke.
by ezyang 15y ago
Duck typing means lots of things. I've replaced it with something which I think is more representative of what I was trying to evoke.
- JoshTriplett 15y agoNamely, "playing fast and loose with data representation"? That makes more sense, yeah. And now, it fits nicely with "pointer tricks" as something I can happily live without. Mutation, on the other hand, I can easily see the arguments for either way; it represents a pretty large thing to give up in exchange for a more "obviously correct" programming environment. But pointer tricks have no place outside of low-level systems programming (OS kernels and language runtimes), and as little of that as possible to bootstrap something more comfortable. I work on BITS (http://biosbits.org/ http://biosbits.org/), a project based on GRUB for doing BIOS testing. It has a pile of low-level C code to interface with hardware and system facilities, as well as other existing C interfaces like ACPICA; however, a while ago we ported the Python runtime, and since then we've ported more and more of the functionality to Python scripts. Python doesn't have static typing, but it does handle memory management and object lifetimes automatically. It represents a good balance of high-level safety and comfort, acceptance by the target audience, and ease of porting to a freestanding environment with no OS support. I still wish I could find and eliminate more errors at compile time rather than only at runtime, but Python certainly manages to avoid the chainsaw-juggling feeling of programming in C.