|
The Laplace Demon posted:templates automate the process of copy pasting the code for FooSet and renaming all the Foo to Bar i was more aiming for 'this is what c++ programmers want, c++' quote:contravariance and covariance are problems for languages with type hierarchies, not golang it has a heirarchy of: interface{} < interface { ... } < ..... concrete type
|
# ? Jul 17, 2017 18:12 |
|
|
# ? May 22, 2024 12:25 |
gonadic io posted:rust could even make this zero-cost for regular int indexing, it'd just get inlined. Have a histogram class backed by an array which accepts floats as indices, and automatically bins and shifts them for you?
|
|
# ? Jul 17, 2017 18:23 |
|
arrays are a special case of dictionaries
|
# ? Jul 17, 2017 18:35 |
|
they really aren't
|
# ? Jul 17, 2017 18:56 |
|
they should certainly be, in k they have the good taste to make it rather explicitly so (though, granted, that also entails making dictionaries ordered, but that has distinct upsides as well)
|
# ? Jul 17, 2017 19:02 |
|
how exactly do you explain the behavior of insert and remove on arrays in terms of a dictionary. "oh it's a set of key/value pairs but these core operations change a bunch of keys, but not all of them". also append vs. dictionary merging and a million other things. the semantic meaning of the indices of an array are just fundamentally different from the meaning of keys in a dictionary it's the pl design insight equivalent of getting super high and rambling about how bird have elbows but they're part of their wings, maaaaaan. but we write them both with subscripts.............
|
# ? Jul 17, 2017 19:12 |
|
pfft, mutability is the issue you are describing there, neither arrays nor dictionaries are suitable for removals, and arrays not for insertions
|
# ? Jul 17, 2017 19:18 |
|
Also multidimensional arrays, but nobody uses languages with good support for multidimensional arrays any more (except for languages that are so poo poo in other ways that it does not matter).
|
# ? Jul 17, 2017 19:20 |
|
If you don't add or remove elements, just modify them, and have a static set of keys... Or if you swap from the back and limit yourself to having one array reference to update. When I was a noob fresh out of school I interviewed a guy who used a hash table keyed by int when an array would clearly work. I was like, wow this is so stupid but he solved the problem and maybe it's some pro interview skill instead of being painstaking about arrays. Nope, the guy was a coding horror factory.
|
# ? Jul 17, 2017 19:21 |
|
to make a more serious post we do live a bit in a bit of a dark age for primitive data structures, in the footsteps of the oo revolution fooling a generation into the idea that one should abstract simple arrays/sets into something else (and that much is, at least, obvious: if you have a set of things you better not be wrapping them up in a ThingSetContainerImpl thingy), and a lot of opportunities got lost along the way. i am not sure multidimensional arrays are first on the list, but they certainly go on it
|
# ? Jul 17, 2017 19:23 |
rjmccall posted:bird have elbows but they're part of their wings whoa
|
|
# ? Jul 17, 2017 19:25 |
|
concatenation: not a core aspect of how people use arrays according to renowned library designer cybernetic vermin
|
# ? Jul 17, 2017 19:26 |
|
rjmccall posted:concatenation: not a core aspect of how people use arrays according to renowned library designer cybernetic vermin well, i assumed your original point on removal was that it had a meaning on both arrays and dictionaries , and the meanings do not agree, which is a good point (i did indeed argue from the k approach, so i disregarded it being an operator). but with concatenation not being an operation on dictionaries things are perfectly straightforward; a function which uses concatenation is concerned with the special case of arrays, and the creation of new unique keys will not be the least strange in that context. a function which regards dictionaries as dictionaries will not be concerned with concatenations (and one can, if one so pleases, define it in some fairly strange way without it being a problem hci/understanding-wise) it is a rather interesting aside how it works in k, but i think i'd rather drop the derail: i was not entirely serious and do not *really* disagree with you
|
# ? Jul 17, 2017 19:36 |
|
fine by me. i will point out that there is a rough equivalent of concatenation for dictionaries, dictionary union, where the result has all the entries of both dictionaries. of course you have to handle semantic conflicts, either by arbitrarily preferring one of the inputs or by somehow merging them mostly it's a sore spot because morons keep showing up on swift-evolution telling us that array subscript should return an optional value because dictionary subscript does
|
# ? Jul 17, 2017 19:49 |
|
oh, yeah, i didn't quite expect that to be a contentious issue, but there are of course always the mindless consistency people. i find the k approach fantastically charming, but it is certainly a solution which makes a lot of other strange design decisions necessary. notably cascading typed nulls which smooth over the fact that more code than usual would otherwise have to be concerned about undefined values no real chance of that ever making it into anything mainstream
|
# ? Jul 17, 2017 20:03 |
|
its unfortunate that julia is a pile of crap or at least used to be idk if it still is but it probably is
|
# ? Jul 17, 2017 20:23 |
|
cinci zoo sniper posted:is there something fundamental about programming language design that there are, i think, no modern interpreted languages with well having completed babies first interpreter I think I'm qualified to make posts about this. i don't think that there's anything stopping a language from being type checked and having eval (which is imo what you're really talking about here), but it wouldn't be that useful because a type error in a dynamic language is just going to be a runtime error, which is arguably better than running incorrect code, but not nearly as useful as static errors ahead of time. also, it means that your language is going to have to lug around all that type information at run time. when evaling a random snippet of code dynamically, the only way to type check against code that's already been evaluated is to have all the type information stored and accessible. that's pretty expensive, I'd assume. "transpiled" languages like typescript -> javascript, or glorified linters like python's type system, make a lot more sense. It gives you the benefits of type checking your code without the costs of doing type checking at run time.
|
# ? Jul 17, 2017 22:23 |
|
What are ppls thoughts on js style async await which is promise based vs python style async await which is based on generators cuz idk the promise way seems better
|
# ? Jul 17, 2017 22:30 |
MALE SHOEGAZE posted:well having completed babies first interpreter I think I'm qualified to make posts about this. makes sense i guess. i wouldnt honestly care much vs inherently statically typed language, and coherently maintained static type tooling that doesn't into eval/base interpreter/what have you. now that ive migrated to python 3, going to research whats up in this regard - i imagine someone has made a decent use of the type annotations by now e: nice, jetbrains have their own type checker for python, and there's a mypy and atom's own thing for other environments cinci zoo sniper fucked around with this message at 22:38 on Jul 17, 2017 |
|
# ? Jul 17, 2017 22:33 |
|
Sapozhnik posted:What are ppls thoughts on js style async await which is promise based vs python style async await which is based on generators cuz idk the promise way seems better there's only one good async and it's C#s
|
# ? Jul 17, 2017 22:52 |
|
cinci zoo sniper posted:what else should i infer from 24/7 anti-go circlejerk everywhere. irl ive seen exactly one go project, and it was some college class project web game backend https://github.com/coreos/etcd https://github.com/kubernetes/kubernetes https://github.com/coreos/flannel https://github.com/containous/traefik https://github.com/gogits/gogs https://github.com/prometheus/prometheus https://github.com/influxdata/influxdb https://github.com/hashicorp/terraform yeah i can't think of any useful golang projects either
|
# ? Jul 17, 2017 23:44 |
|
gogs is extremely ehhh-tier and smells kind of gangrenous i use it because the competition is git "download and launch the entire contents of tucows lol" lab. https://docs.gitlab.com/ce/install/installation.html seriously just look at this loving poo poo
|
# ? Jul 17, 2017 23:51 |
VOTE YES ON 69 posted:https://github.com/coreos/etcd lomarf
|
|
# ? Jul 18, 2017 00:06 |
|
Sapozhnik posted:gogs is extremely ehhh-tier and smells kind of gangrenous not that defend gitlab in the general case, but they provide docker packages so you can ignore that whole install doc. that said gitlab is bad, probably don't use it.
|
# ? Jul 18, 2017 00:32 |
|
Sapozhnik posted:What are ppls thoughts on js style async await which is promise based vs python style async await which is based on generators cuz idk the promise way seems better
|
# ? Jul 18, 2017 01:05 |
|
Cybernetic Vermin posted:they should certainly be, in k they have the good taste to make it rather explicitly so (though, granted, that also entails making dictionaries ordered, but that has distinct upsides as well) rjmccall posted:i will point out that there is a rough equivalent of concatenation for dictionaries, dictionary union, where the result has all the entries of both dictionaries. of course you have to handle semantic conflicts, either by arbitrarily preferring one of the inputs or by somehow merging them the bleeding-edge experimental flavors of k do in fact define dictionary overloads for most primitive operators. it's really nice: code:
Internet Janitor fucked around with this message at 01:36 on Jul 18, 2017 |
# ? Jul 18, 2017 01:32 |
|
necrotic posted:not that defend gitlab in the general case, but they provide docker packages so you can ignore that whole install doc. oh yeah, install a huge garbage bag of moving parts with a huge potential attack surface onto my server using a docker image that is maintained by the sorts of people who think that ruby and ubuntu are a good idea why yes, i would like to go gently caress myself!
|
# ? Jul 18, 2017 01:35 |
|
Sapozhnik posted:oh yeah, install a huge garbage bag of moving parts with a huge potential attack surface onto my server using a docker image that is maintained by the sorts of people who think that ruby and ubuntu are a good idea just pointing out theres the "easy way" much like download/run gogs only gitlab does more so obviously theres more. but yeah, go gently caress yourself.
|
# ? Jul 18, 2017 01:46 |
|
VOTE YES ON 69 posted:https://github.com/coreos/etcd I've had to work with etcd lately and uhhh... I'd call it broken. Is Go at fault? Maybe if you could make a generic concurrency utility it'd be easier to engineer an ability to stream its log at a rate of more than O(1) bytes per heartbeat with no flow control.
|
# ? Jul 18, 2017 02:27 |
|
rjmccall posted:how exactly do you explain the behavior of insert and remove on arrays in terms of a dictionary. "oh it's a set of key/value pairs but these core operations change a bunch of keys, but not all of them". also append vs. dictionary merging and a million other things. the semantic meaning of the indices of an array are just fundamentally different from the meaning of keys in a dictionary there's kind of two use cases for arrays. one is putting items in numbered boxes, and this is a subset of dictionary use. the other is having a contiguous sequence of items, where insertion and removal shift everything, and you might split or splice them. that's more like the way you use a list
|
# ? Jul 18, 2017 03:00 |
|
me, dumb: duhhhhh but the backing storage is different you, immutably: there is no state, only execution
|
# ? Jul 18, 2017 03:03 |
|
Dylan16807 posted:there's kind of two use cases for arrays. one is putting items in numbered boxes, and this is a subset of dictionary use. the other is having a contiguous sequence of items, where insertion and removal shift everything, and you might split or splice them. that's more like the way you use a list in what world do you actually use an array to put things in numbered boxes tho, where the numbering is stable and independently semantically meaningful alt: also your two use cases are in fact exactly why dictionaries and arrays are different. the first use case is a good match for a dictionary and not for an array, and the second is a good match for an array and not for a dictionary. they are different concepts serving different use cases and neither is a special case of the other
|
# ? Jul 18, 2017 03:37 |
|
arrays are not dictionaries but too many people have programmed in php
|
# ? Jul 18, 2017 03:54 |
|
hash tables.... are just hash maps with integer keys !!!
carry on then fucked around with this message at 04:19 on Jul 18, 2017 |
# ? Jul 18, 2017 03:55 |
|
in lua, tables are both arrays and dictionaries & they're 1-indexed. the worst of both worlds.
|
# ? Jul 18, 2017 03:58 |
|
don't make me talk about mumps again
|
# ? Jul 18, 2017 04:04 |
|
carry on then posted:hash tables.... are just hash maps with integer keys !!! js is even worse:
|
# ? Jul 18, 2017 04:44 |
|
tef posted:it has a hierarchy of: interface{} < interface { ... } < ..... concrete type how did i forget edit: CommunistPancake posted:in lua, tables are both arrays and dictionaries & they're 1-indexed. the worst of both worlds. ffs, i've been stubbing my toe on this for a few days now The Laplace Demon fucked around with this message at 04:49 on Jul 18, 2017 |
# ? Jul 18, 2017 04:47 |
|
rjmccall posted:in what world do you actually use an array to put things in numbered boxes tho, where the numbering is stable and independently semantically meaningful When your keys are, like, non-sparse numbers? An example would be an array holding info about every block in a database file.
|
# ? Jul 18, 2017 05:04 |
|
|
# ? May 22, 2024 12:25 |
MALE SHOEGAZE posted:well having completed babies first interpreter I think I'm qualified to make posts about this. But don't most interpreted / dynamic languages carry around type information at runtime? I know python does, and I'm pretty sure most flavors of lisp do, too.
|
|
# ? Jul 18, 2017 05:50 |