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
kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

Jose Valasquez posted:

wtf is a ring buffer

imagine 4 balls on the edge of an array

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

Jose Valasquez posted:

wtf is a ring buffer
It's a data structure that was introduced by the influential website goatse.cx

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

when source engine games freeze and you hear the last half second of audio over and over and over again, that's a ring buffer

jesus WEP
Oct 17, 2004


carry on then posted:

when source engine games freeze and you hear the last half second of audio over and over and over again, that's a ring buffer
drat goons really can’t fit the meter

Cybernetic Vermin
Apr 18, 2005

p. sure ring buffer is gen z slang for your sphincter.

FMguru
Sep 10, 2003

peed on;
sexually

Jose Valasquez posted:

wtf is a ring buffer
a tool used to clean and polish rings (and other forms of jewellery)

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

tracecomplete posted:

Go huffers have spent the last decade telling me I am a fool and a poltroon for wanting a baseline modern language because Rob Pike Said It Wasn't Important (he didn't really but Go huffers also can't read), this guy is fine.

and now they're all pretending that they never said that generics are bad and would actively make the language worse

The Leck
Feb 27, 2001

kitten emergency posted:

imagine 4 balls on the edge of an array

I’m amazed at how well this describes it

fritz
Jul 26, 2003

jesus WEP posted:

drat goons really can’t fit the meter

can't fit a lot of things

MononcQc
May 29, 2007

Jose Valasquez posted:

wtf is a ring buffer
Serious answer here.

So a normal queue or a buffer can be implemented as either an array or linked lists. To maintain First In First Out (FIFO) semantics, you want to be able to add data at one end of the data structure (append to be consumed last) and to consume it from the other (remove at the start).

In a linked list this is easy to do because you can keep a pointer to the end of the list and add elements there, while you remove from the head of the list. However, this requires a bunch of dynamic memory allocation is rather indirect. With an array implemented naively, you'd need to move data around (if you always remove from the 0 index, then you would need to move all other entries around which would be very inefficient).

A ring buffer uses a fixed-size array and has one pointer for the insertion location, and one pointer for the consumption location. When either reaches the end of the array, it wraps back to the start. As long as you properly make sure that the writer never takes over the reader (the queue is full) then you're able to use a single pre-allocated array to contain all your bufferable data in a single area and just move pointers around (you can overwrite the data already read before having to de-allocate or garbage collect it), which gives you very good performance.

In the context of generics, this is useful because the array size is usually a function of the type of data you want to store in there. So if you want to make a generic ring buffer, you'll need to be able to keep the same interface (and implementation) regardless of the data type you want to use. Generics let you do that. Go not supporting generics means that each implementation has to either be unique (copy-pasted with a search and replace for each data type), or needs to store interface{} references, which is garbage.

MononcQc fucked around with this message at 21:22 on Jan 23, 2022

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
yeah. people often make the argument that generics systems lead to over-abstraction and some kinda silly code patterns (which is fair, they absolutely can do that), and so they try to justify not having generics by saying that having a few well-chosen generic currency types (lists, dictionaries) and algorithms (sort, find) is really 90% of what you need (probably also true) and that the last 10% isn’t worth the complexity and the risk of having a bunch of annoying generics weenies running around for the next five years defining numeric taxonomies. ring buffers make a good counter-argument because they’re relatively well-known and pretty unambiguously useful for certain use cases. if you think about things with similar recognition, a lot of them are stuff like alternative list/dictionary implementations (linked lists, sorted trees) with several decades of arguments against using them outside of really specialized code

Progressive JPEG
Feb 19, 2003

its particularly egregious in go where the people afraid of generics are the same ones splashing interface{} (aka void pointer) casts everywhere and acting like that's better

i guess its the next generation of C weenie mindset now that i think about it

dads friend steve
Dec 24, 2004

I never got the whole argument that generics are confusing because imo they’re more intuitive than other Go language features that people don’t seem to have beef with. channels and pointer vs value receivers come to mind. like yeah it gets hairy once u need to start dealing with covariant vs contravariant types but most common uses don’t need to care about that

MononcQc
May 29, 2007

yeah a lot of the generic issues come with the subtyping when you allow class hierarchies where the -variant types get in. The rest of it is pretty straightforwards in general.

dads friend steve
Dec 24, 2004

I haven’t looked at Go generics but shouldn’t it be easier for them than most languages anyway? all they have are structs, typedefs and interfaces. and structs/interfaces cannot extend or inherit from each other. all the language provides is embedding which afaik is just syntactic sugar

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

dads friend steve posted:

I haven’t looked at Go generics but shouldn’t it be easier for them than most languages anyway? all they have are structs, typedefs and interfaces. and structs/interfaces cannot extend or inherit from each other. all the language provides is embedding which afaik is just syntactic sugar

i haven’t looked at them since the original proposal but my recollection is, much like go modules, they’re too clever by half and more awkward to work with than you’d hope

MononcQc
May 29, 2007

Go generic iirc have one specific problem in that nil is both a standalone type and also a variation of an interface (an interface can be a typed nil), which sadly means that golang may have to deal with covariance and contravariance but only for god drat nils.

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

MononcQc posted:

Go generic iirc have one specific problem in that nil is both a standalone type and also a variation of an interface (an interface can be a typed nil), which sadly means that golang may have to deal with covariance and contravariance but only for god drat nils.

hilarious

dads friend steve
Dec 24, 2004

lmao

Xik
Mar 10, 2011

Dinosaur Gum
jsiaajdsdaa 10 minutes ago | parent | context | favorite | on: Ask HN: Where are you going to find long-form cont...

I think I'm fundamentally opposed to long form content. I can learn a lot more from one line of code than 10 pages of theory.

Xik
Mar 10, 2011

Dinosaur Gum
hersko 30 minutes ago | parent | context | favorite | on: Ask HN: Where are you going to find long-form cont...

The Joe Rogan podcast. Listening to long-form, multi-hour conversation is so refreshing compared to what traditional news shows have become.



e: ok last one since this thread is like cheating


randycupertino 1 hour ago | parent | context | favorite | on: Ask HN: Where are you going to find long-form cont...

/r/TrueReddit and /r/FoodforThought subreddits are both pretty interesting and tend to have insightful long-form articles.

mystes
May 31, 2006

It's very on brand that the first comment in that thread links to a astral codex ten

tracecomplete
Feb 26, 2017

dads friend steve posted:

I never got the whole argument that generics are confusing because imo they’re more intuitive than other Go language features that people don’t seem to have beef with. channels and pointer vs value receivers come to mind. like yeah it gets hairy once u need to start dealing with covariant vs contravariant types but most common uses don’t need to care about that

I don't have anything useful to respond to this post with but I saw your avatar and I'm really thinking about replacing it with a still from Erlang: The Movie right now

tracecomplete
Feb 26, 2017

Meanwhile this entire beaucoup loving bonkers thread

https://news.ycombinator.com/item?id=30061040

"I was deceived about Covid safety"

Naturally it's a substack and naturally the first wet plop of "evidence" is a chart taken out of context and cropped to fit an argument the chart's authors expressly do not hold to be true, so equally naturally the hackernewses slurp it up with a spoon

quote:

csense 37 minutes ago | prev | next [–]

I got the original two shots, but I have not and will not get the booster.

One factor in this decision is the fact that people who have legitimate questions are answered with "You're dumb and anti-science! If you don't take it, you'll lose your job, and never be able to get on an airplane ever again!"

How should a reasonable person respond when honest, good-faith questions are answered by suppressing the questioner with name-calling and government-sanctioned force?

Nomnom Cookie
Aug 30, 2009



MononcQc posted:

yeah a lot of the generic issues come with the subtyping when you allow class hierarchies where the -variant types get in. The rest of it is pretty straightforwards in general.

java generics are a pretty good argument against rejecting generics due to complexity. cause theyre super complex and like ten people understand java generics fully and its fine. i still dont know what a lub is and yet i can make generic types just fine. some of them even had type parameters with multiple bounds, which i mostly used to find a bug in the jdk and demonstrate to the coder after me how dangerous it is to let a mid go unsupervised

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
I've done some very dodgy stuff with Java generics.

Like writing a Wrapper<T extends SomeClass & SomeInterface> so that I could then pass around Wrapper<?> instances and write code that was polymorphic over my interface, but that I could also pass to something that expected an instance of SomeClass.

Why I didn't just add a getAsSomeClass() method to the interface that just returns this I still don't know.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
every static type system has limitations. we just had someone on the swift forums suggest permitting typealias Fn = (Input) -> Fn because it'd be useful when writing non-terminating state machines, and i had to politely yet firmly inform them that it was never going to happen. eventually you get the hang of what a language can and can't do, and how you get things done, but before you reach that point it can feel pretty frustrating. and some people really develop mental blocks and refuse to get through that, the same way that some people refuse to learn algebra

Nomnom Cookie
Aug 30, 2009



Jabor posted:

I've done some very dodgy stuff with Java generics.

Like writing a Wrapper<T extends SomeClass & SomeInterface> so that I could then pass around Wrapper<?> instances and write code that was polymorphic over my interface, but that I could also pass to something that expected an instance of SomeClass.

Why I didn't just add a getAsSomeClass() method to the interface that just returns this I still don't know.

i had abstract generic controller classes that would have like AbstractAdminController<T extends CRUDEntity & Image> and use reflection in the constructor to find out the actual parameter for T and generate an admin UI for the entity. iirc the jdk bug was that passing a T into a lambda that expected an Image would fail at runtime

olorum
Apr 24, 2021

TameAntelope 1 hour ago | root | parent | next [–]

I'd actually flip that, and say if you can't give daily feedback you're a "bad" developer (I'd probably use "inexperienced" or "new" rather than "bad", because it's a hard mindset shift and it takes time).

In fact, not only should you be able to give daily updates, you should be able to ship functionality on the daily. From first line of code into production and in front of customers should only ever take about 2 to 16 hours of work.

If you can't work at that cadence, you're probably not being as effective as you could be, as a developer. A "good" manager enables you to work like this.

reply

jesus WEP
Oct 17, 2004


tell me you’ve only worked on fun size apps without telling me you’ve only worked on fun size apps

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
tell me you've never worked on software with legal or ethical consequences for bugs without telling me you've never worked on software with legal or ethical consequences for bugs

dads friend steve
Dec 24, 2004

my lived experience is universally applicable, and is an effective benchmark to measure your own competency against

Nomnom Cookie
Aug 30, 2009



olorum posted:

TameAntelope 1 hour ago | root | parent | next [–]

I'd actually flip that, and say if you can't give daily feedback you're a "bad" developer (I'd probably use "inexperienced" or "new" rather than "bad", because it's a hard mindset shift and it takes time).

In fact, not only should you be able to give daily updates, you should be able to ship functionality on the daily. From first line of code into production and in front of customers should only ever take about 2 to 16 hours of work.

If you can't work at that cadence, you're probably not being as effective as you could be, as a developer. A "good" manager enables you to work like this.

reply

seems like a big leap from talking about what you did yesterday (if you did something you can also say that you did it) to pushing code daily. which requires a lot of infrastructure and process maturity to do properly

Zamujasa
Oct 27, 2010



Bread Liar

Nomnom Cookie posted:

seems like a big leap from talking about what you did yesterday (if you did something you can also say that you did it) to pushing code daily. which requires a lot of infrastructure and process maturity to do properly


the old boss just edited files live on the server over ftp. why make it more complicated than it has to be

Sapozhnik
Jan 2, 2005

Nap Ghost
maybe i'm telling on myself a bit here but i've always wondered how people like that manage the evolution of their database schema

MrQueasy
Nov 15, 2005

Probiot-ICK

Sapozhnik posted:

maybe i'm telling on myself a bit here but i've always wondered how people like that manage the evolution of their database schema

Thoughts and prayers.

Switzerland
Feb 18, 2005
Do what thou must do.

Sapozhnik posted:

maybe i'm telling on myself a bit here but i've always wondered how people like that manage the evolution of their database schema

the ol' import/export db.sql razzmatazz!

Nomnom Cookie
Aug 30, 2009



Zamujasa posted:

the old boss just edited files live on the server over ftp. why make it more complicated than it has to be

i guess if you have no process whatsoever then pushing code daily is also easy. huh

i think there is a valley between "we're idiots and just push everything to prod immediately" and "we've put so much engineering into our CI/CD infrastructure that we just push everything to prod immediately" which is where you find people who think git flow is a good idea. they have to avoid breaking production but can't afford to automate it

Zamujasa
Oct 27, 2010



Bread Liar

Sapozhnik posted:

maybe i'm telling on myself a bit here but i've always wondered how people like that manage the evolution of their database schema

what is there to manage? just add new columns and tables as needed

Adbot
ADBOT LOVES YOU

alexandriao
Jul 20, 2019


Maximo Roboto posted:

bad opinion from hn poster

not agreeing, but on the same general subject, something that I do miss is voices with singing power -- it seems to have gone out of fashion?

Like, the 1980s, most woman singers I can think of in pop had kinda slightly deep, powerful voices, and a careful use of vibrato

And I am kind of just sad that we do not have more of that in the mainstream in general

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