| 9:48 am on Mar 24, 2014 (gmt 0)|
|I prefer to just use something else... |
Just curious, what "something else"?
I feel a bit of a heathen for saying this, as I am aware of the negative aspects, but I have come to really like PHP's "weakly typedness"!
| 1:04 pm on Mar 24, 2014 (gmt 0)|
Is what you like weak typing or dynamic typing?
I use Python which is strongly but dynamically typed. See the original wiki: [c2.com ]
I used to use TCL which is weakly typed, and find Python's multiplicity of types very useful - ordered dicts, named typles, sets, queues and more as well as the usual ints, strings, floats, associative arrays etc.
There are lots of really good languages out there, many with decent libraries and frameworks - JVM languages like Scala and Clojure have all the Java libraries for a start. Python has a massive standard library and a lot of third party libraries and frameworks.
| 9:19 pm on Mar 24, 2014 (gmt 0)|
|Is what you like weak typing or dynamic typing? |
Yes. :) But yes, I do really mean "dynamically" typed. (This was really in reference to the "Type Annotations" mentioned on hacklang.org that appears to enforce "static" typing.) Not so much a fan of the "weak/loose" typing, would always prefer explicit type conversion whenever possible.
| 11:06 am on Mar 25, 2014 (gmt 0)|
Yes, it is static typing, but it is optional, so you would use it sparingly where it is likely to catch future bugs.
Have you ever tried a language with type inference? I am happy with dynamic + strong, but type inference seems to give you the advantages of static without the verbosity.
| 2:44 pm on Mar 25, 2014 (gmt 0)|
Interesting, I have not used a language with "type inference". This would seem to be more suited to certain types of languages(?), or can be implemented partially in more "complex" languages... "In the case of complex forms of higher-order programming and polymorphism, it is not always possible for the compiler to infer as much, however, and type annotations are occasionally necessary for disambiguation." Wikipedia [en.wikipedia.org]
Explicitly declaring types (in the case of statically typed languages) help to self document the code. How do type inferred languages manage this without writing additional comments? Maybe this can be built into the IDE (if this is possible before compilation)? After all, in PHP I do still document the expected types (as I think many do) with PHPDoc-style comments that identify the parameter and return types in function/method signatures.
| 4:35 pm on Mar 25, 2014 (gmt 0)|
Type inference seems most common in functional languages. I did not know why but there is an explanation on the C2 Wiki again [c2.com ]
I think the documentation problem is also minimised in these languages as it should also be fairly clear to a human reader of the code what return type is expected.
I like linking to the C2 wiki because everyone forgets it was the original, and for many people wiki is synonymous with The Other One! Not often I get the chance though.