|
here's what you should probably do to create an object of an implied type in regular old javascript so you don't end up killing yourself with stupid javascript bullshit:code:
|
# ? Apr 12, 2015 21:01 |
|
|
# ? May 23, 2024 01:28 |
|
stop fretting so much, there is no perfect language, newbies will be confused by everything anyways.
|
# ? Apr 12, 2015 21:02 |
|
and i bet jslint complains about all of these things too
|
# ? Apr 12, 2015 21:06 |
|
I find I care less and less about typedness of languages (I do however enjoy optional typing because it's what feels the most like eating my cake and having it) as I work more and more with systems that are distributed. I'm going to enjoy the local consistency of a code base, but this internal consistency won't be worth poo poo if it doesn't properly carry over to other parts of the system, how they fail, or given how much impedance mismatch you get across parts. The level at which the tricky lovely bugs show up end up being related to rules extremely hard to properly encode in a type system (you'd probably need idris or agda). The simplest example is to think of ISO-8859-1 encoded data that is pretty much always readable as if it were utf-8, although the meaning changes and data gets subtly corrupted. You'll only find about it when data crosses many subsystems and reaches a human who goes "wait that's not right". Usually these tricky rear end bugs end up uncovering some very foundational or basic assumption you made when designing things, and that will need a lot of work to correct.
|
# ? Apr 12, 2015 21:24 |
|
comedyblissoption posted:yeah but that's a strawman argument that no one who prefers large amounts of type inference is advocating idk, while i've never heard anyone outright claim that you should never have to explicitly state what type something is except for when the language requires it, i think a lot of people go through a phase where they think that when first exposed to good type inference, until they've worked with it for a while and hit places where they wish some things had their types annotated for readability
|
# ? Apr 12, 2015 22:52 |
comedyblissoption posted:i think python is great for teaching imperative programming I haven't really looked into either recursion or folds in python, but what makes it particularly hostile towards them?
|
|
# ? Apr 13, 2015 02:30 |
|
http://neopythonic.blogspot.co.uk/2009/04/tail-recursion-elimination.htmlguido posted:I recently posted an entry in my Python History blog on the origins of Python's functional features. A side remark about not supporting tail recursion elimination (TRE) immediately sparked several comments about what a pity it is that Python doesn't do this, including links to recent blog entries by others trying to "prove" that TRE can be added to Python easily. So let me defend my position (which is that I don't want TRE in the language). If you want a short answer, it's simply unpythonic. http://www.artima.com/weblogs/viewpost.jsp?thread=98196 guido posted:About 12 years ago, Python aquired lambda, reduce(), filter() and map(), courtesy of (I believe) a Lisp hacker who missed them and submitted working patches. But, despite of the PR value, I think these features should be cut from Python 3000.
|
# ? Apr 13, 2015 03:50 |
|
MononcQc posted:The simplest example is to think of ISO-8859-1 encoded data that is pretty much always readable as if it were utf-8, although the meaning changes and data gets subtly corrupted. You'll only find about it when data crosses many subsystems and reaches a human who goes "wait that's not right". Usually these tricky rear end bugs end up uncovering some very foundational or basic assumption you made when designing things, and that will need a lot of work to correct. I think you really have three kinds of bug -- shallow ones that any type system can catch ("you passed a function pointer, I wanted a double"), shallow ones no type system can catch for e.g. halting problem reasons (things like passing 'let x = x in x' to a function that's going to use its args in Haskell), and deep ones a type system could conceivably catch but that's not the point. The last kind of bugs come from bad assumptions about the nature of the problem. When you go to the Idris website and see a perfectly-manicured rock paper scissors player or something that's provably going to follow the rules, that's easy to write because rock paper scissors is super well-defined. But you can write flawless rock paper scissors in almost any language assuming you're not a flake, because it's so well-defined. Compare that to a really hard problem like deciding whether an airplane reservation is valid for any airline in the world and you realize there's no math model that makes business rules not confusing. So I think a lot of the people who think "we just need a type system strong enough to catch all the bugs" are putting the cart before the horse. The type-based representation of rock-paper-scissors isn't what makes their solution totally watertight -- it, like the watertight solution, is just an expression of how well they understand the problem. I still think it's pretty important to catch the first kind of bugs though, and on a problem where everyone's vision of the problem is a little different it might be nice to have a type-based representation of the problem preventing clashing ideas from getting manifested in the program. EDIT: lingua latina Krotera fucked around with this message at 16:16 on Apr 13, 2015 |
# ? Apr 13, 2015 05:16 |
|
The airline reservation problem is fun, by the way, because it's anathema to abstraction. Any abstraction you make around airline reservations in general is wrong and any type-based representation has to encode all the requirements that makes them hard to represent in the first place -- so it's either demonstrably incorrect or it's probably bugged. Oy vey!
|
# ? Apr 13, 2015 05:18 |
|
at least a static type system will catch you adding currency to number of passengers or something like that
|
# ? Apr 13, 2015 07:38 |
|
Shinku ABOOKEN posted:at least a static type system will catch you adding currency to number of passengers or something like that Almost any static type system can do that, though: you can even do it in Java if you wrap your numeric types. That's not idiomatic, but doing it idiomatically in e.g. Haskell (a language with one of those type systems people like to wax poetic about) needs a language extension (GeneralizedNewTypeDeriving) or Java-equivalent boilerplate anyway. EDIT: lingua latina Krotera fucked around with this message at 16:15 on Apr 13, 2015 |
# ? Apr 13, 2015 07:55 |
|
please stop using ie when you mean eg, it's triggering me
|
# ? Apr 13, 2015 08:55 |
|
Krotera posted:What advantages does that have over i.e. Java? Earnest question -- I'm not really a Pascal guy and don't see the appeal. good introduction to C in my experience
|
# ? Apr 13, 2015 11:04 |
|
Shinku ABOOKEN posted:at least a static type system will catch you adding currency to number of passengers or something like that Only if you had the discipline to distinguish these integer types in the first place.
|
# ? Apr 13, 2015 12:25 |
|
MononcQc posted:Only if you had the discipline to distinguish these integer types in the first place. yeah i probably wouldn't have bothered, GeneralisedNewtypeDeriving or no. i tend to do it for units that are plausible to mix up, for example different coordinate systems or measurement units or escaped/unescaped text. Mayyyybe i would have done it for currency but no way wouldl i for number of passengers.
|
# ? Apr 13, 2015 12:43 |
|
Soricidus posted:please stop using ie when you mean eg, it's triggering me
|
# ? Apr 13, 2015 12:43 |
|
Soricidus posted:please stop using ie when you mean eg, it's triggering me also stop putting spaces before and after your em dashes thank,
|
# ? Apr 13, 2015 14:50 |
|
Krotera posted:Almost any static type system can do that, though: you can even do it in Java if you wrap your numeric types. That's not idiomatic, but doing it idiomatically in i.e. Haskell (a language with one of those type systems people like to wax poetic about) needs a language extension (GeneralizedNewTypeDerivnig) or Java-equivalent boilerplate anyway. F# does this natively with very little syntax. It's called units of measure, specifically designed to make tagging primitive types with more type data easy. If you use it for stuff like SI units it'll also simplify your units automatically when you do a bunch of arithmetic with tagged values
|
# ? Apr 13, 2015 15:32 |
|
Arcsech posted:F# does this natively with very little syntax. It's called units of measure, specifically designed to make tagging primitive types with more type data easy. wow that is rad
|
# ? Apr 13, 2015 15:39 |
|
and fsharp is open source and it has an emacs mode i might just have to learn this poo poo, if only for the units of measure gimmick in interactive use https://github.com/fsharp/
|
# ? Apr 13, 2015 15:40 |
|
yeah it's pretty sweet unfortunately the thought leaders on my team are way more into JavaScript
|
# ? Apr 13, 2015 15:44 |
|
Soricidus posted:please stop using ie when you mean eg, it's triggering me Do you have an authoritative source? Last guy I ran into said it was completely opposite way. (way I'm using now) I think I'm going to just expand those acronyms from here on out.
|
# ? Apr 13, 2015 16:11 |
|
e.g. == exempli gratia == "for example" i.e. == id est == "that is"
|
# ? Apr 13, 2015 16:13 |
|
Mr. Glass posted:e.g. == exempli gratia == "for example" Crud! Let me go back and fix all those posts. EDIT: Fixed. Hope nobody went into a coma. Krotera fucked around with this message at 16:24 on Apr 13, 2015 |
# ? Apr 13, 2015 16:14 |
|
i wish ubungu wasn't the default linux for third-party development, it really is such a bad linux (but i repeat myself lol) seeing this bizarro parallel universe microsoft developing a bunch of their core infrastructure as bona fide cross platform open source projects using git and stuff is just weird as hell
|
# ? Apr 13, 2015 16:46 |
|
Notorious b.s.d. posted:and fsharp is open source f# units of measure are sweet as hell but they make me wish the rest of the language was better so i could use it more
|
# ? Apr 13, 2015 16:54 |
|
GrumpyDoctor posted:f# units of measure are sweet as hell but they make me wish the rest of the language was better so i could use it more what don't you like about f#? I'm honestly curious, I really like f# and sure it has some rough edges but it's probably my language of choice at the moment
|
# ? Apr 13, 2015 17:02 |
|
Arcsech posted:what don't you like about f#? I'm honestly curious, I really like f# and sure it has some rough edges but it's probably my language of choice at the moment number one is the way you can't have cycles in your type dependency graph unless the types live in the same file number two is how far its tooling is behind c#'s i love the language as a language (it's easily my favorite on that level), but using it in a "real" project has always felt like more of a headache than it's worth
|
# ? Apr 13, 2015 17:20 |
|
Mr. Glass posted:e.g. == exempli gratia == "for example" good mnemonic is e.g. = "example given" and i.e. = "in effect"
|
# ? Apr 13, 2015 18:22 |
|
HappyHippo posted:good mnemonic is e.g. = "example given" and i.e. = "in effect" The guy I ran into last said "in example" and "oh, the other one."
|
# ? Apr 13, 2015 18:24 |
|
in example? lol, sounds like he's misspelling "an example"
|
# ? Apr 13, 2015 18:39 |
|
Mr. Glass posted:e.g. == exempli gratia == "for example" i am in favor of improved use of these terms
|
# ? Apr 13, 2015 18:47 |
|
HappyHippo posted:good mnemonic is e.g. = "example given" and i.e. = "in effect" good mnemonic is knowing latin
|
# ? Apr 13, 2015 18:49 |
|
Mr. Glass posted:good mnemonic is knowing latin i once convinced my friends that ibid was the name of a latin guy who wrote a ton of books
|
# ? Apr 13, 2015 18:59 |
|
Mr. Glass posted:good mnemonic is knowing latin sic
|
# ? Apr 13, 2015 19:06 |
|
prefect posted:i once convinced my friends that ibid was the name of a latin guy who wrote a ton of books tolk aboot owned
|
# ? Apr 13, 2015 19:24 |
|
I find I care more about static typing for personal projects. I like keeping them clean/maintainable and I read back to them later in life to see how much I improved. Python is still cool though. otoh, dynamic typing at work because gently caress everything and spew code out like a broken fire hydrant. Not like anything I'm working on will be used 5 years later.
|
# ? Apr 13, 2015 19:39 |
|
MeruFM posted:Not like anything I'm working on will be used 5 years later. famous last words
|
# ? Apr 13, 2015 19:45 |
|
Soricidus posted:famous last words probably more like "not like i'll be here in 5 years"
|
# ? Apr 13, 2015 19:55 |
|
|
# ? May 23, 2024 01:28 |
|
writing a mess of p-lang spaghetti kinda makes the 5 years thing a self-fulfilling prophesy
|
# ? Apr 13, 2015 19:57 |