Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dynamically typed languages don't need generics to write 'lambda function' and pseudo functional programming libraries.
- If the type system become too complex, it can be a good thing to rely more on runtime constraints,
- rather than on compile-time type constraints.
- generics involve
- 1. Compilation time overhead
- 2. Type synthax gynamastics required to instanciates object, and checking their type everywhere in the program.
- 3. Inconsistenties of the type system between different compilations tool chain.
- 4. Complex interface logic, which hinder interoperability.
- Lots of these problem seem to creep in most object oriented language.
- it's very easy to create simple closures and lamba function in dynamically typed languages.
- It quickly become very complex and involve lot of overhead with statically typed languages.
- Dynamic typing allow
- 1. Simple compilation process, interface use generic dynamically typed object.
- 1. Reference to objects and data in the code can be type checked/converted based on runtime informations.
- 2. Can solve type constraint based on expressions evaluated at runtime.
- 3. Easy interface with web protocols using XML or json.
- The only argument in favor of generics would be runtime performance
- 1. No runtime overhead, with proper use of inlining, complex C++ templates almost come as 'zero cost abstraction'.
- 2. Using packed binary representation of objects use very little memory and code to access all the data is more efficient.
- But it comes also with the price that
- 1. It makes garbage collection more difficult, no type informations at runtime.
- 2. Debugguing is difficult, complex error messages, complex object type can become hard to track and analyze.
- 3. No reflection possible, which prevent automatic serialization of objects.
- One example where it make the most difference, is for parsing HTML/CSS files to see if they are conform to a structure
- that the javascript code expect.
- There are system like TypeScript who can do this.
- The problem is that most of the tools used by graphician won't necessarily support them in my experience rather
- use the HTML/CSS format as close as possible to what graphician uses.
- A better system i think is XML/XSLT, it has the advantage to
- Only output valid HTML, with charset verification, html entities.
- Keep the structure of XSLT files close to HTML.
- HTML generation from the data can be made either by the client's browser or the server.
- the format of XML data can be checked for confirmity with a Data Type Definition.
- but even this would be alien for most graphicians.
- JavaScript allow to easily write code where lot of references and program logic can only be resolved at runtime,
- and depend on complex structured data.
- This capacity to generate object definition based on runtime parameters, and using those object as parameters of lamba function
- is one of the things that make dynamically typed language powerfull.
- They allow inherently to write generic program, which are function that can be used to execute a conceptually similar task on objects of different types.
- All functions using dynamically typed object with runtime checks are generic function.
- Dynamic typing has a better encapsulation for data definition at runtime, and can express more complex constraints,
- except they are checked at runtime based on dynamically evaluated expressions instead of
- relying only on the OOP informations at compile time.
Add Comment
Please, Sign In to add comment