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
Bloody
Mar 3, 2013

is this on github

I must see this

Adbot
ADBOT LOVES YOU

akadajet
Sep 14, 2003

Bloody posted:

what the gently caress

yep, I’m gonna need more explanation of this one

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

animist posted:

my current project is a webassembly -> verilog compiler in rust

this is almost certainly a terrible idea

seriously what is the motivation

JawnV6
Jul 4, 2004

So hot ...
what does it even mean

webassembly is, i presume, something like a procedural language at some level

comedyblissoption
Mar 15, 2006

DONT THREAD ON ME posted:

i have a basic generic linked list and if i want to define map it's all pointers to void and casting. pretty gross.
void pointer casting blesses you with the worst of all worlds of both a shittier unsafe type system combined with potentially shittier performance

Mao Zedong Thot
Oct 16, 2008


Shaggar posted:

as a childless nerd I can confirm factorio is far more interesting than learning a research language.

SHAGGAR IS RIGHT AGAIN

bad sign

Mao Zedong Thot
Oct 16, 2008


the real mindkiller is having a kind of fulfilling day job (go figure) -- absolutely zero interest in computer programming when i do even somewhat fun, interesting or novel things at work

my github.com contributions graph is like the perfect inverse of when i'm happy at work

Sapozhnik
Jan 2, 2005

Nap Ghost

redleader posted:

i'm extremely jealous of how motivated you are to do things

qhat
Jul 6, 2015


What's a legit alternative to clusters of nodejs express servers behind a load balancer?

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

qhat posted:

What's a legit alternative to clusters of nodejs express servers behind a load balancer?

clusters of golang servers behind a load balancer

Xarn
Jun 26, 2015

Sapozhnik posted:

dont do c++ its super bad
:wrong:

Sapozhnik posted:

otoh c is fine for what it is
:right:

gonadic io
Feb 16, 2011

>>=

prisoner of waffles posted:

some states? have data breach laws. like if your company know that a lot of personally identifying information has been lost to the haxors, your company may be required to let people know.

generally speaking, there ain't laws against being bad at information security in almost every industry? so it's a more holistic question of what level of harm might occur, who / how many could it happen to, and how easy or likely such a security breach is

https://mobile.twitter.com/internetofshit/status/1034573568418476032

https://mobile.twitter.com/gonadic_io/status/1034592697674285056

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
but share prices

gonadic io
Feb 16, 2011

>>=
Ultimately if your boss is on paper saying they're OK with the product being easily hackable then you can escalate (to their boss, or idk press or some regulatory agency for your industry), do nothing, or keep trying to convince your manager. Not sure what other options there are

gonadic io
Feb 16, 2011

>>=
Non tech management caring about security/hackability is a double-edged sword believe me

Luigi Thirty
Apr 30, 2006

Emergency confection port.

It is by will alone I set my mind in motion. It is by the chip of Dorito that thoughts acquire speed, the fingers acquire stains, the stains become a warning. It is by will alone I set my mind in motion.

*eats dorito*

https://twitter.com/LuigiThirty/status/1035443417130717184

necrotic
Aug 2, 2005
I owe my brother big time for this!
ctps: got the first screen of space invaders to render but then it segfaults. gotta put this down for the weekend though i dont want to

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


I was searching for a solution to a dumb xml deslerialisation problem (yes this again, I only work on this poo poo on Fridays) and I think the posters response to the answer adequately sums up my experience with this:


https://stackoverflow.com/questions/46576778/c-sharp-xml-array-deserialization-returns-only-first-element posted:

Thank you a lot! But who's gonna return me back 6 hours of my life?

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
ctps: I don't know which is dumb: Go's automatic pointer dereferencing, me, or both

Like, I understand pointers, conceptually, but because Go uses pointers but automatically dereferences them most of the time I never really know what's happening. Like today I have a thing coming in that's an interface{} and I'm trying to unbox it into a *turd, which I want to then dereference so I can run it through the lovely Go JSON serializer (which apparently is turning my pointer into {} instead of dereferencing it and giving me {"TurdType":"brown"})

edit: oh naturally, the answer is "use reflection": https://stackoverflow.com/questions/49540367/how-do-i-dereference-a-pointer-value-passed-as-the-empty-interface

jesus h loving dipstick christ

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
go was my first introduction to pointers and it's a confusing language to learn them in.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Finster Dexter posted:

ctps: I don't know which is dumb: Go's automatic pointer dereferencing, me, or both

Like, I understand pointers, conceptually, but because Go uses pointers but automatically dereferences them most of the time I never really know what's happening. Like today I have a thing coming in that's an interface{} and I'm trying to unbox it into a *turd, which I want to then dereference so I can run it through the lovely Go JSON serializer (which apparently is turning my pointer into {} instead of dereferencing it and giving me {"TurdType":"brown"})

edit: oh naturally, the answer is "use reflection": https://stackoverflow.com/questions/49540367/how-do-i-dereference-a-pointer-value-passed-as-the-empty-interface

jesus h loving dipstick christ

uhhhh maybe the problem is that you have turd.turdType and not TurdType?

https://play.golang.org/p/d7Gdjxa5blH

code:
package main

import (
	"encoding/json"
	"os"
)

type butt struct {
	fart1, Fart2 string
}

type Butt struct {
	Fart1, Fart2 string
}

func main() {
	var enc = json.NewEncoder(os.Stdout)
	var buttPtr = new(butt)
	buttPtr.fart1="a"
	buttPtr.Fart2="b"
	enc.Encode(interface{}(buttPtr))
	enc.Encode(buttPtr)
	enc.Encode(*buttPtr)
	
	var ButtPtr = new(Butt)
	ButtPtr.Fart1="a"
	ButtPtr.Fart2="b"
	enc.Encode(interface{}(ButtPtr))
	enc.Encode(ButtPtr)
	enc.Encode(*ButtPtr)
}

{"Fart2":"b"}
{"Fart2":"b"}
{"Fart2":"b"}
{"Fart1":"a","Fart2":"b"}
{"Fart1":"a","Fart2":"b"}
{"Fart1":"a","Fart2":"b"}

Program exited.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
I think part of why people hate on go so much is because perhaps too many of the people now writing blogposts about how "it's so fweaking awesome" are not much more insightful than the crowd succinctly mocked by the "mongodb is webscale" computer-generated voiceover vids?

like a good answer to that stackoverflow question is "what the gently caress are you doing? why aren't you using the stdlib database package?" and if indeed their usecase requires that they have a different interface and be able to unmarshal into any struct, then indeed they do need reflection, there's no way to git'r'dun without reflection

trash-tier programming and thinking happens regardless of programming language

Shaggar
Apr 26, 2006
yes people hate it because its a bad language with bad foundations promoted by bad developers. exactly the same reason everyone hated mongodb

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
like if they really need to be able to pass in a pointer to Basically Any Type as an interface{} and unmarshal a value from a db into it, they need to use A LOT MORE REFLECTION than their code currently contains

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
when i was dealing with go sql, i dealt with this problem by writing a query builder where the select statement builder would track the types of the selected columns and then it would know what to unmarshall each element of the result tuple into. this breaks down in a lot of cases but it still worked way better than it should. no reflection!

still needed to manually map the result set into the target struct, but at least the types of each element would be known so you don't have to cast everything positionally.

gonadic io
Feb 16, 2011

>>=

DONT THREAD ON ME posted:

when i was dealing with go sql, i dealt with this problem by writing a query builder where the select statement builder would track the types of the selected columns and then it would know what to unmarshall each element of the result tuple into. this breaks down in a lot of cases but it still worked way better than it should. no reflection!

still needed to manually map the result set into the target struct, but at least the types of each element would be known so you don't have to cast everything positionally.

congrats you build your own type system

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

gonadic io posted:

congrats you build your own type system

even back then i was mad 4 types

Shaggar
Apr 26, 2006
dapper maps db types to c# types using reflection for property/parameter type/name matching, but it also caches that mapping. You can manually specify mapping as well but that defeats the point of using dapper.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
yeah i mean i don't think reflection is the wrong approach but nothing in the go stblib makes it easy for you. which is honestly fine i dunno why the stlib has a sql abstraction.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
Lack of generics is annoying, too.

VikingofRock
Aug 24, 2008




I'm surprised that Go has pointers, although I guess I shouldn't be because it's so C-inspired. It's just I've never seen pointers in a garbage-collected language before. I'm guessing this means things in Go are copied on assignment / being passed to a function, and pointers are a way to explicitly avoid that copy? Is there ever a way to get a dangling pointer in Go, or does having a pointer to an object prevent that object from being garbage collected?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

VikingofRock posted:

I'm surprised that Go has pointers, although I guess I shouldn't be because it's so C-inspired. It's just I've never seen pointers in a garbage-collected language before. I'm guessing this means things in Go are copied on assignment / being passed to a function, and pointers are a way to explicitly avoid that copy? Is there ever a way to get a dangling pointer in Go, or does having a pointer to an object prevent that object from being garbage collected?

this is the best info i can find really:

https://golang.org/doc/faq#Pointers

i think it's not that different from java in practice

DONT THREAD ON ME fucked around with this message at 17:30 on Aug 31, 2018

mystes
May 31, 2006

prisoner of waffles posted:

I think part of why people hate on go so much is because perhaps too many of the people now writing blogposts about how "it's so fweaking awesome" are not much more insightful than the crowd succinctly mocked by the "mongodb is webscale" computer-generated voiceover vids?

like a good answer to that stackoverflow question is "what the gently caress are you doing? why aren't you using the stdlib database package?" and if indeed their usecase requires that they have a different interface and be able to unmarshal into any struct, then indeed they do need reflection, there's no way to git'r'dun without reflection

trash-tier programming and thinking happens regardless of programming language
It's just annoying that despite go coming after a lot of better languages, everyone was acting like it was god's gift to mankind.

All the other languages should have won but somehow all have managed to shoot themselves in the foot in various ways so we're left with languages like python and go winning.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
not to mention javascript on the backend

VikingofRock
Aug 24, 2008




DONT THREAD ON ME posted:

this is the best info i can find really:

https://golang.org/doc/faq#Pointers

i think it's not that different from java in practice

Okay yeah after reading through that it looks like assignment and argument passing both invoke a shallow copy of the data, and there's no way to get a dangling pointer without using unsafe.Pointer.

It's been a long time since I used Java so I can't remember how memory semantics work there. The only GC languages I commonly used nowadays are Python and Haskell. I've only recently felt like I really understood Python's assignment semantics and in Haskell things are generally immutable so it mostly doesn't matter whether things are copied deeply, shallowly, or not at all.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

VikingofRock posted:

Okay yeah after reading through that it looks like assignment and argument passing both invoke a shallow copy of the data, and there's no way to get a dangling pointer without using unsafe.Pointer.

It's been a long time since I used Java so I can't remember how memory semantics work there. The only GC languages I commonly used nowadays are Python and Haskell. I've only recently felt like I really understood Python's assignment semantics and in Haskell things are generally immutable so it mostly doesn't matter whether things are copied deeply, shallowly, or not at all.

speaking of assignment semantics, rvalue references are weird after doing rust.

other weird c++ stuff:

1. templates are not generics. they're so weird! they feel both more and less powerful than generics.
2. ugh, the class system...
3. googling for things is bad. online documentation is bad. cpp reference is the best resource i've found, and i can't imagine learning from this if I were new to programming holy poo poo.
4. exceptions look like a rabbit hole
5. no interfaces or traits, just abstract classes. i'm sure there are some more esoteric mechanisms for these things though. i really love interfaces though and cant imagine programming without them.

you can really feel the age of the language. i think i was expecting "modern" c++ to feel more modern but it really doesn't. esp the OO stuff, which was like, the original impetus for the language, but is now not really the selling point it used to be,.

DONT THREAD ON ME fucked around with this message at 18:06 on Aug 31, 2018

VikingofRock
Aug 24, 2008




DONT THREAD ON ME posted:

speaking of assignment semantics, rvalue references are weird after doing rust.

other weird c++ stuff:

1. templates are not generics. they're so weird! they feel both more and less powerful than generics.
2. ugh, the class system...
3. googling for things is bad. online documentation is bad. cpp reference is the best resource i've found, and i can't imagine learning from this if I were new to programming holy poo poo.
4. exceptions look like a rabbit hole
5. no interfaces or traits, just abstract classes. i'm sure there are some more esoteric mechanisms for these things though. i really love interfaces though and cant imagine programming without them.

you can really feel the age of the language. i think i was expecting "modern" c++ to feel more modern but it really doesn't. esp the OO stuff, which was like, the original impetus for the language, but is now not really the selling point it used to be,.

I pretty much agree with all of your impressions. C++ was the first language I got comfortable with, and I basically did it by reading through an Herb Sutter book followed by one of the Scott Meyers books (this was around 2010 so I was learning C++03). Those two authors come from a specific school of C++ thought which basically says that you should pretty rarely use inheritance at all. Templates cover a lot of the same functionality that you would use traits / interfaces for; just think of the constraints as being implicit from the function that you are writing ("I use the + operator here") instead of explicit ("my arguments implement Addable").

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
c++11 has traits as part of its stdlib

VikingofRock
Aug 24, 2008




Also now that I've thought a little more on Go's shallow-copy-on-assignment, I'm a little perturbed by it. It seems to me like that breaks encapsulation a bit too much. For example, if I'm using a Point3D type, I shouldn't worry if internally the x, y, and z coordinates are stored as three separate member floats or as a single vector of three floats. But with shallow copy semantics, all of the sudden those are very different semantically if I pass a Point3D to a function and then mutate one of the coordinates.

Admittedly I've never used Go so it's possible I'm misreading the copy semantics or that there are idioms which mitigate this issue. But as I understand it it seems like a weird choice to me.

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009
I was taught this about inheritance from my mentor:

Inheritance is cool and good, but can get you into trouble quickly.
If you go more than 2 levels of inheritance, you need to take a good long look at your code and probably refactor it.

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