Guest User

Untitled

a guest
May 26th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. Dynamically typed languages don't need generics to write 'lambda function' and pseudo functional programming libraries.
  2.  
  3. If the type system become too complex, it can be a good thing to rely more on runtime constraints,
  4. rather than on compile-time type constraints.
  5.  
  6. generics involve
  7.  
  8. 1. Compilation time overhead
  9. 2. Type synthax gynamastics required to instanciates object, and checking their type everywhere in the program.
  10. 3. Inconsistenties of the type system between different compilations tool chain.
  11. 4. Complex interface logic, which hinder interoperability.
  12.  
  13. Lots of these problem seem to creep in most object oriented language.
  14.  
  15. it's very easy to create simple closures and lamba function in dynamically typed languages.
  16. It quickly become very complex and involve lot of overhead with statically typed languages.
  17.  
  18. Dynamic typing allow
  19.  
  20. 1. Simple compilation process, interface use generic dynamically typed object.
  21. 1. Reference to objects and data in the code can be type checked/converted based on runtime informations.
  22. 2. Can solve type constraint based on expressions evaluated at runtime.
  23. 3. Easy interface with web protocols using XML or json.
  24.  
  25. The only argument in favor of generics would be runtime performance
  26.  
  27. 1. No runtime overhead, with proper use of inlining, complex C++ templates almost come as 'zero cost abstraction'.
  28. 2. Using packed binary representation of objects use very little memory and code to access all the data is more efficient.
  29.  
  30. But it comes also with the price that
  31.  
  32. 1. It makes garbage collection more difficult, no type informations at runtime.
  33. 2. Debugguing is difficult, complex error messages, complex object type can become hard to track and analyze.
  34. 3. No reflection possible, which prevent automatic serialization of objects.
  35.  
  36.  
  37. One example where it make the most difference, is for parsing HTML/CSS files to see if they are conform to a structure
  38. that the javascript code expect.
  39.  
  40. There are system like TypeScript who can do this.
  41.  
  42. The problem is that most of the tools used by graphician won't necessarily support them in my experience rather
  43. use the HTML/CSS format as close as possible to what graphician uses.
  44.  
  45. A better system i think is XML/XSLT, it has the advantage to
  46.  
  47. Only output valid HTML, with charset verification, html entities.
  48. Keep the structure of XSLT files close to HTML.
  49. HTML generation from the data can be made either by the client's browser or the server.
  50. the format of XML data can be checked for confirmity with a Data Type Definition.
  51.  
  52. but even this would be alien for most graphicians.
  53.  
  54. JavaScript allow to easily write code where lot of references and program logic can only be resolved at runtime,
  55. and depend on complex structured data.
  56.  
  57. This capacity to generate object definition based on runtime parameters, and using those object as parameters of lamba function
  58. is one of the things that make dynamically typed language powerfull.
  59.  
  60.  
  61. 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.
  62.  
  63. All functions using dynamically typed object with runtime checks are generic function.
  64.  
  65. Dynamic typing has a better encapsulation for data definition at runtime, and can express more complex constraints,
  66. except they are checked at runtime based on dynamically evaluated expressions instead of
  67. relying only on the OOP informations at compile time.
Add Comment
Please, Sign In to add comment