Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
tef
May 30, 2004

-> some l-system crap ->

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

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




gonadic io posted:

rust could even make this zero-cost for regular int indexing, it'd just get inlined.

brb building library.

e: this package gives you n-dimensional indices: https://docs.rs/ndarray/0.10.0/ndarray/
and i'm not sure there's other use cases for arbitrarily-typed indices.

Have a histogram class backed by an array which accepts floats as indices, and automatically bins and shifts them for you?

Cybernetic Vermin
Apr 18, 2005

arrays are a special case of dictionaries

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
they really aren't

Cybernetic Vermin
Apr 18, 2005

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
Sep 7, 2007

no worries friend
Fun Shoe
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.............

Cybernetic Vermin
Apr 18, 2005

pfft, mutability is the issue you are describing there, neither arrays nor dictionaries are suitable for removals, and arrays not for insertions

Athas
Aug 6, 2007

fuck that joker
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).

sarehu
Apr 20, 2007

(call/cc call/cc)
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.

Cybernetic Vermin
Apr 18, 2005

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

VikingofRock
Aug 24, 2008




rjmccall posted:

bird have elbows but they're part of their wings

whoa

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
concatenation: not a core aspect of how people use arrays according to renowned library designer cybernetic vermin

Cybernetic Vermin
Apr 18, 2005

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

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
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

Cybernetic Vermin
Apr 18, 2005

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

Bloody
Mar 3, 2013

its unfortunate that julia is a pile of crap or at least used to be idk if it still is but it probably is

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

cinci zoo sniper posted:

is there something fundamental about programming language design that there are, i think, no modern interpreted languages with strongstatic type system?

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.

Sapozhnik
Jan 2, 2005

Nap Ghost
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

cinci zoo sniper
Mar 15, 2013




MALE SHOEGAZE posted:

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.

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

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

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

Mao Zedong Thot
Oct 16, 2008


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 :shrug:

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 :rolleyes:

Sapozhnik
Jan 2, 2005

Nap Ghost
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

cinci zoo sniper
Mar 15, 2013





lomarf

necrotic
Aug 2, 2005
I owe my brother big time for this!

Sapozhnik posted:

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

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.

mystes
May 31, 2006

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
Why does it make any difference? Aren't they both just continuations in the end? I've never used python async stuff, though, only c# and javascript (actually typescript because I'm not a barbarian).

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

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:
 a: `a`b`c!3 7 9
 b: `c`a!24 0
 c: `b`g!99 1000

 2#a        / take 2; preserve order
`a`b!3 7
 
 a|b        / maximum; keep order of left dict
`a`c!3 24

 a,c        / concat; start with left, right items override
`a`b`c`g!3 99 9 1000

 5<a        / arithmetic/logic operators penetrate to values
`a`b`c!0 1 1

 &5<a       / where; extracts keys with nonzero values
`b`c

 >a         / grade-down; sort keys by values descending
`c`b`a

Internet Janitor fucked around with this message at 01:36 on Jul 18, 2017

Sapozhnik
Jan 2, 2005

Nap Ghost

necrotic posted:

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.

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!

necrotic
Aug 2, 2005
I owe my brother big time for this!

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

why yes, i would like to go gently caress myself!

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.

sarehu
Apr 20, 2007

(call/cc call/cc)

VOTE YES ON 69 posted:

https://github.com/coreos/etcd

yeah i can't think of any useful golang projects either :rolleyes:

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.

Dylan16807
May 12, 2010

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

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.............

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

JawnV6
Jul 4, 2004

So hot ...
me, dumb: duhhhhh but the backing storage is different
you, immutably: there is no state, only execution

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

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

JewKiller 3000
Nov 28, 2006

by Lowtax
arrays are not dictionaries but too many people have programmed in php

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

hash tables.... are just hash maps with integer keys !!!

carry on then fucked around with this message at 04:19 on Jul 18, 2017

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

in lua, tables are both arrays and dictionaries & they're 1-indexed. the worst of both worlds.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
don't make me talk about mumps again

There Will Be Penalty
May 18, 2002

Makes a great pet!

carry on then posted:

hash tables.... are just hash maps with integer keys !!!

js is even worse:

The Laplace Demon
Jul 23, 2009

"Oh dear! Oh dear! Heisenberg is a douche!"

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

sarehu
Apr 20, 2007

(call/cc call/cc)

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.

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




MALE SHOEGAZE posted:

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.

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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply