The Devil in Plain Text
devblog.arnebrasseur.net
devblog.arnebrasseur.net
Try a statically typed language sometime - they're not all like Java. You might be surprised.
This statement shows the kind of damage Java has done to the larger programming community.
Let me tell you the reason why people shudder to use to Java for things like text processing. To do as simple a task- to simply read from a file, do minimal processing(like extracting fields) and write to another, you have to deal with tens of api calls often with long names. Its extremely difficult if not impossible to remember each and every api call and the order they need to called in. So the net result is every time you need to do something, no matter how simple. You simply go to the internet, get a known-to-work-well template and just copy-paste it into your code.
And this is just the beginning, a sufficiently large Java application can be totally incomprehensible to understand, modify or develop without an IDE. Far too many nested api calls, far too much XML. Bulk of Java code today in the wild is machine generated and machine modified(I mean through IDE's)
Java these days feels like assembly language programming. You have to play with far too many api's to do even the simplest of the tasks.
No wonder people flock to a dynamic language at every chance they get.
http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html
Quoting it: "In other words, you're performing string surgery on the serialized representation of a tree structure. Just stop and think how insane that really sounds!"
>>> from webhelpers.html import literal
>>> p1, p2 = literal("<p>"), literal("</p>")
>>> foo = "foo&<bar>"
>>> type(p1)
<class 'webhelpers.html.builder.literal'>
>>> type(foo)
<type 'str'>
>>> p1 + foo + p2
literal(u'<p>foo&<bar></p>')
And yes, having this sort of thing implemented at the language level, in a generic way that can apply to HTML, SQL, and anything else would be wonderful.While we're asking for ponies, I'd also like it if "costOfPieInDollars = distanceInMiles + angleInDegrees" would be an error (unless each part was explicitly cast to a compatible type, eg the base int)...
To tell the truth, I’ve never found any use for this feature.
Some examples from the documentation:
quantity<length> L = 2.0*meters;
quantity<energy> E = kilograms*pow<2>(L/seconds);
quantity<plane_angle> theta = 0.375*radians;
quantity<dimensionless> sin_theta = sin(theta);
quantity<plane_angle> thetap = asin(sin_theta);
I figured Haskell's type system could also do this sort of thing, and it can. I found Dimensional: https://code.google.com/p/dimensional/, but I'm not sure if it's in standard use in the Haskell community. Examples: https://code.google.com/p/dimensional/wiki/IspExampleType tagging.
* *
* *
) (\___/) (
* /( \ (. .) )\ *
# ) c\ >' ( #
' )-_/ '
\\|, ____| |__ ,|//
\ ) ( ` ~ ) ( /
#\ / /| . ' .) \ /#
| \ / ) , / \ / |
\,/ ;;,,;,; \,/
_,#;,;;,;,
/,i;;;,,;#,;
(( %;;,;,;;,;
)) ;#;,;%;;,,
_// ;,;; ,#;,
/_) #,; //
// \|_
\|_ |#\
|#\ -"
-"There was a template language called ptl in python using things like htmltext and it is actually a crazy dog biting everything's and everyone touching it.