On Tuesday, 13 September 2016 06:31:20 UTC+3, davidmi...@gmail.com wrote:
>
> I've spent many, many, many hours on this (measured in days, at this 
> point) and I'm convinced that Golang is missing a fundamental programming 
> capability, that of multidimensional associative arrays. Searching through 
> this forum's archives and other sites, I've found that I'm not the first 
> one to face this problem and no one who has posted about this has yet 
> received a decent response (at least, not one that I have found)! The best 
> responses consist either of maps that are, at most, two levels deep or maps 
> whose depth is known in advance and declared using something like 
> make(map[string]map[string]map[string]map[string]map[string]string) and 
> even in those cases, one cannot replace a map with just a string on any of 
> those levels. 
>

I know it's frustrating to convert one piece of software based on a set of 
idioms, to another language that uses other idioms. I can remember trying 
to convert some highly OO JavaScript code to Delphi -- oh it was a pain and 
in the end it looked terrible in Delphi.

I guess one point everyone is trying to get across is that "Go doesn't have 
a multidimensional array -- at least not a convenient one -- for a reason." 

Implicit structures significantly harm readability at the cost of 
convenience. I.e. it's probably fine for small code bases (i.e. below 
50KLOC and ~5 people), but the larger it gets the harder it is to verify 
that the structures are consistently used. This means that refactoring is 
more difficult. *(You can partly see TypeScript and Hack as trying to deal 
with the aftermath.)*

But, I should say -- I love JS objects -- they are super-convenient and 
nice to use... but I wouldn't use them in Go.

So, let's take a step back, 

and investigate how people would solve your problem in Go -- rather than 
figuring out, how to write PHP code in Go. Remember Go is not PHP, JS nor 
Haskell... hence the code you write in Go will look different than in any 
of those languages. Yes, the larger code structures will stay the same, but 
the details will vary. *Sure, the first conversion could be crude.*

Basically, what business problem are you trying to solve with 
multidimensional arrays? If you can show the PHP code you are trying to 
convert, it would be even better.

+ Egon

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to