@BenjaminGruenbaum If I can swap Java EE for .Net at work sometime in the next year or two, I won't care what their evil hidden agenda(s) might be, it'll still be worth having real collection classes.
@BenjaminGruenbaum Scala is interesting. I like it, especially conceptually, but have a few fatal complaints (at least for my applications). Thrashing small-object allocations and obscene operator overloading.
@towc ok :) Could you just check these few lines of text : pastebin.com/SbgxQpRG, I had to translate a french exercise into english... Are there some grammar mistakes ?
@towc It's not a homework, I'm the teacher ;) and very rarely, I have to translate exercises into english. I did it, but I wanted to be sure if there are no mistakes
var list = ["Bob", "george", "ass"];
var index = [0, 1, 2];
function player(targetList, indices) {
this.targetList = targetList;
this.indices = indices;
}
var player1 = new player(list, index);
var player2 = new player(list, index);
player2.targetList.splice(1, 1);
console.log(player1.targetList);
@ssube depends on how you define it, but you can also define your own. I agree that it's abuse prone - but I don't think it's more abuse prone than plain old functions.
On an unrelated note - @Shog9 I'm not getting any swag am I :(?
@BenjaminGruenbaum Agreed, although it can be harder to read. Again, huge fan of the concept of operator overloading (makes perfect sense for string cat), but it gets... bad.
@towc i mean for ex, in Jan 97 , there are 35%, in Feb 97, there are 35,1%, in Aug 97, there are 36.2%, etc. until Dec 98, 39.1%, ==> the students will have to computer the average % on this time period
@ssube it's not just string cat, doing .then all over JS because we can't create a >>= operator and that we can't implement operators and constructs ourselves is very limiting. We can't create DSLs easily and it's frustrating - Scala was very freeing in that regard.
@KendallFrey if you wanted to splice(1,1) for player2 only, you'd have to more or less re-assign the new array. player2.targetList = player2.targetList.splice(1,1);?
@ssube JS doesn't sport hash maps as far as I know. No collections in JS except arrays. If you're talking about objects those are hardly hash maps (both conceptually and in practice) and they're horrible at using them as such (only string keys for one).
@BenjaminGruenbaum For most purposes, you can implement JS with objects being maps, and treat them as such in the language. Specifically, in that almost any x.y can become x["y"], and then things get mushy.
@ssube generally I agree, it's not just a very good or elegant solution. Luckily most JS code isn't very complicated and doesn't require very clever collections.
@ssube I'd work with Lua, I think it's pretty decent. Although to be fair I find JS a pretty decent language for what I use it for. It's just not a very good general purpose language.
I know a lot of people hate state, but it's very easy to reason about in small amounts compared to immutability - function signatures are much simpler etc.
@ssube I think it mostly sounds intimidating, all it generally does is turn var t = obj.doA() where doA returns an 'A' into var (obj, t) = obj.doA() where doA doesn't change the state of obj but returns a mutated obj instead (and t is still an A). I find multithreading a lot more confusing :P
We at the JS chat room want to throw short monthly challenges where everyone gets the same task in a new language/library/framework.
The idea is to learn a new technology, code something fun and share knowledge, opinions and experience. The scope is meant to be rather small. It's something one s...
Pros: looping queries and lists is very easy. Great compatibility with excel sheets and pdfs, etc. Cons: 1 indexed, Structures are confusing, and functions are a massive overhead to write and call.
@BenjaminGruenbaum I got multithreading (and thread safety) real quick when I started doing graphics libs. Every game a) does it wrong, b) ignores "this is not thread safe", and c) calls everything all at once.