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
Volte
Oct 4, 2004

woosh woosh
getting mercilessly destroyed as a programmer and as a human being is the number two reason i would not want to work on the linux kernel. having to write mission-critical C code is numero uno

Adbot
ADBOT LOVES YOU

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
:byewhore:

my feelings are clearly the most important thing

Luigi Thirty
Apr 30, 2006

Emergency confection port.

edgy

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



if you think making GBS threads on people creates better work, you should kill yourself

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
well, my parents were emotionally abusive and i turned out perfect, so clearly

Volte
Oct 4, 2004

woosh woosh
has anyone started a coding collective to rewrite the linux kernel in rust yet? i'll make the code of conduct

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I didn't quote the bit at the bottom where she says she's going to stay off the internet for the next few days because you know how angry nerds are going to respond

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Luigi Thirty posted:

I didn't quote the bit at the bottom where she says she's going to stay off the internet for the next few days because you know how angry nerds are going to respond

good call :(

tef
May 30, 2004

-> some l-system crap ->
look, i dunno about you put standing up on the breakfast table and making GBS threads everywhere is a normal process. look, the guys are just blowing off steam, i know it's a bit lovely, but this is how the big boys work in the big world.

we've tried to accommodate your feelings, heck, piss-only-thursdays has been a great success, but we all came here to do make a good product, and you can't make an omelette without cracking a few eggs, and you can't make good software without telling other people that they're wrong, loudly, and scoring points. meritocracy is not a team game.

you've being far too sensitive and you're bringing down morale with your complains and negative attitude. you need to join in the fun, roll with the punches, and poo poo on the breakfast table.

tef
May 30, 2004

-> some l-system crap ->
being a jerk doesn't make you good at programming, but you do get to feel awfully smug when you tell people they're wrong

i mean, how else is everyone going to know you're right? i mean you didn't write any documentation

gonadic io
Feb 16, 2011

>>=

tef posted:

look, i dunno about you put standing up on the breakfast table and making GBS threads everywhere is a normal process. look, the guys are just blowing off steam, i know it's a bit lovely, but this is how the big boys work in the big world.

we've tried to accommodate your feelings, heck, piss-only-thursdays has been a great success, but we all came here to do make a good product, and you can't make an omelette without cracking a few eggs, and you can't make good software without telling other people that they're wrong, loudly, and scoring points. meritocracy is not a team game.

you've being far too sensitive and you're bringing down morale with your complains and negative attitude. you need to join in the fun, roll with the punches, and poo poo on the breakfast table.

https://www.youtube.com/watch?v=urSubeOywus

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

tef posted:

being a jerk doesn't make you good at programming, but you do get to feel awfully smug when you tell people they're wrong

cf. thomas figg's php talk from some edinburgh programmer meetup

tef
May 30, 2004

-> some l-system crap ->

https://www.youtube.com/watch?v=co_DNpTMKXk

Sapozhnik
Jan 2, 2005

Nap Ghost
.

Bloody
Mar 3, 2013


same, Mr Dog. same

suffix
Jul 27, 2013

Wheeee!
i had to concatenate a lot of strings in javascript today

normally with immutable strings you'd either want to use some sort of string builder or save them up in an array for a single concatenation call, so a 'correct' solution might be:
code:
var ButtArray = [];
for (var i = 0; i < 1000000; i++) {
  ButtArray.push("butt");
}
var Butts = ButtArray.join("");
but javascript programmers don't do that poo poo, so browsers engines use lazy concatenation so the naive code is actually faster:
code:
var Butts = "";
for (var i = 0; i < 1000000; i++) {
  Butts += "butt";
}
but there's no language guarantee that's non-quadratic, it just happens to work on the major browsers, except old versions of internet explorer

so you can either do it the 'correct' way and be some hundred milliseconds slower on good browsers, or do it the naive way and take several minutes on ie8 and other rando browsers

or more likely figure out a way not to do this in javascript

fritz
Jul 26, 2003

suffix posted:

i had to concatenate a lot of strings in javascript today

normally with immutable strings you'd either want to use some sort of string builder or save them up in an array for a single concatenation call, so a 'correct' solution might be:
code:

var ButtArray = [];
for (var i = 0; i < 1000000; i++) {
  ButtArray.push("butt");
}
var Butts = ButtArray.join("");

but javascript programmers don't do that poo poo, so browsers engines use lazy concatenation so the naive code is actually faster:
code:

var Butts = "";
for (var i = 0; i < 1000000; i++) {
  Butts += "butt";
}

but there's no language guarantee that's non-quadratic, it just happens to work on the major browsers, except old versions of internet explorer

so you can either do it the 'correct' way and be some hundred milliseconds slower on good browsers, or do it the naive way and take several minutes on ie8 and other rando browsers

or more likely figure out a way not to do this in javascript

doesn't JavaScript have promises, do it both ways and use whichever returns first

AWWNAW
Dec 30, 2008

heads you lose. tails you lose

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

fritz posted:

doesn't JavaScript have promises, do it both ways and use whichever returns first

oooommmmmgggg lol

tef
May 30, 2004

-> some l-system crap ->

Blotto Skorzany posted:

cf. thomas figg's php talk from some edinburgh programmer meetup

yep i'm a big jerk

Max Facetime
Apr 18, 2009

the trouble with high-level languages is you need to write an AST rewriter for your code to be able to reason about what it will actually do

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
the reddit peanut gallery is the worst

https://www.reddit.com/r/linux/comments/3nksp0/closing_a_door_the_geekess/cvp0eso?context=1

pepito sanchez
Apr 3, 2004
I'm not mexican

Max Facetime posted:

the trouble with high-level languages is you need to write an AST rewriter for your code to be able to reason about what it will actually do

http://asmjs.org/spec/latest/


HEHEHEHEHEHHE

sarehu
Apr 20, 2007

(call/cc call/cc)

Suspicious Dish posted:

the reddit peanut gallery is the worst

Reddit posts belong in the HN thread.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

sarehu posted:

Reddit posts belong in the HN thread.

why would i read the hn thread

Cybernetic Vermin
Apr 18, 2005

string concatenation being loving expensive in java is p. stupid tbqh, only some kind of stockholm syndrome that makes the explicit stringbuilder poo poo seem acceptable

Soricidus
Oct 21, 2010
freedom-hating statist shill

Cybernetic Vermin posted:

string concatenation being loving expensive in java is p. stupid tbqh, only some kind of stockholm syndrome that makes the explicit stringbuilder poo poo seem acceptable

this isn't the terrible programmer thread

sarehu
Apr 20, 2007

(call/cc call/cc)
Assume we're on a 32-bit platform. Maybe "size" should be a 31-bit unsigned integer type ranging from [0, 2^31). Then, when you subtract two sizes, you get a signed 32-bit integer. There are no implicit integer conversions.

Discuss.

Volte
Oct 4, 2004

woosh woosh

sarehu posted:

Assume we're on a 32-bit platform. Maybe "size" should be a 31-bit unsigned integer type ranging from [0, 2^31). Then, when you subtract two sizes, you get a signed 32-bit integer. There are no implicit integer conversions.

Discuss.
Restricting the very notion of a size to be a positive integer seems like an unnecessarily heavy thing to do. It's one thing for a negative size to be invalid semantically, but its a whole other ballgame for it to be invalid syntactically. Negative sizes as arguments to an operation could easily be interpreted as an intention to perform the opposite operation (eg, shrink instead of grow), so why eliminate that option for seemingly no benefit?

edit: also you wouldn't be able to subtract two sizes and then use the result as a size, even though the (absolute) difference between two sizes is still intuitively a size

sarehu
Apr 20, 2007

(call/cc call/cc)

Volte posted:

It's one thing for a negative size to be invalid semantically, but its a whole other ballgame for it to be invalid syntactically.

What does this have to do with syntax?

Volte posted:

Negative sizes as arguments to an operation could easily be interpreted as an intention to perform the opposite operation (eg, shrink instead of grow), so why eliminate that option for seemingly no benefit?

For that, you would use the signed 32-bit type that you get when you subtract two sizes. Let's say it's named ptrdiff_t or diff, or ssize_t or something else that isn't int32_t.

Volte posted:

edit: also you wouldn't be able to subtract two sizes and then use the result as a size, even though the (absolute) difference between two sizes is still intuitively a size

You could, by converting the value back to a size.

Volte
Oct 4, 2004

woosh woosh

sarehu posted:

What does this have to do with syntax?
A negative size is inexpressible in the syntax of the language.

sarehu posted:

For that, you would use the signed 32-bit type that you get when you subtract two sizes. Let's say it's named ptrdiff_t or diff, or ssize_t or something else that isn't int32_t.
But then you aren't using the size type at all and its existence (or non-existence) is moot.

sarehu posted:

You could, by converting the value back to a size.
If the conversion has to be done by the user and cannot be validated by the type system (i.e., what if you try to convert a negative size?) then I don't see what this new type offers at all, other than a bunch of new syntactic overhead.

sarehu
Apr 20, 2007

(call/cc call/cc)

Volte posted:

A negative size is inexpressible in the syntax of the language.

I don't know what this even means. Whether you can make a negative size or not has nothing to do with syntax at all.

Volte posted:

But then you aren't using the size type at all and its existence (or non-existence) is moot.

Yes you are, because values of type size can't be negative, and values of type ptrdiff can be.

Volte posted:

If the conversion has to be done by the user and cannot be validated by the type system (i.e., what if you try to convert a negative size?) then I don't see what this new type offers at all, other than a bunch of new syntactic overhead.

If you try to convert a negative value to a size, you get an error.

distortion park
Apr 25, 2011


Cybernetic Vermin posted:

string concatenation being loving expensive in java is p. stupid tbqh, only some kind of stockholm syndrome that makes the explicit stringbuilder poo poo seem acceptable

I thought the '+' operator gets optimised into string builder now

Shaggar
Apr 26, 2006

Cybernetic Vermin posted:

string concatenation being loving expensive in java is p. stupid tbqh, only some kind of stockholm syndrome that makes the explicit stringbuilder poo poo seem acceptable

strings are immutable in java so that's why its a thing. but if you want to be lazy just use like java 1.6+ cause the complier will detect some kinds of string concatenation in loops and replace it w/ string builder.

Cybernetic Vermin
Apr 18, 2005

Shaggar posted:

strings are immutable in java so that's why its a thing. but if you want to be lazy just use like java 1.6+ cause the complier will detect some kinds of string concatenation in loops and replace it w/ string builder.

it is a pretty weak reason though, just being a bit lazy in general about it would be easy to do and could be done fairly safely, just keeping a collection of strings until some linear operation both motivates and hides the effort of realizing the concatenation. an argument could possibly be made that deferring it is a bit dangerous to legacy software which does a *lot* of concatenations and then performs an indexof/charat in a fantastically performance-sensitive part of the system, which is the only O(1) operation on a string as it stands, since some more work would need to be performed at that point, but such software is effectively already making assumptions about gc so w/e

i rather suspect that this is mostly a matter of not invalidating a bunch of old hotspot optimizations which rely on the internals of the current string implementation (as well as general inertia), but it is pretty clearly a bit of an overly primitive gotcha detail that java otherwise retains rather few of

Volte
Oct 4, 2004

woosh woosh

sarehu posted:

I don't know what this even means. Whether you can make a negative size or not has nothing to do with syntax at all.
Yes it does. Writing -1 where a size is expected becomes syntactically invalid. Developers are not given the freedom to define semantics for a negative size because the syntax does not abide it.

sarehu posted:

Yes you are, because values of type size can't be negative, and values of type ptrdiff can be.
Begging the question.

sarehu posted:

If you try to convert a negative value to a size, you get an error.
So in other words, the whole thing is an overreaching runtime assertion that over-defines the meaning of "size".

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
It doesn't overdefine size, negative sizes are absurd and your proposed use for them to reverse operations is a dopey footgun

sarehu
Apr 20, 2007

(call/cc call/cc)
Hrm. I was just wondering how overflow-checked subtraction of type (u32, u32) -> i32 could be implemented. It turns out overflow happens if SF != CF (those are the sign flag and the carry flag). Unfortunately there's no condition code for that with Intel.

sarehu
Apr 20, 2007

(call/cc call/cc)

Volte posted:

Yes it does. Writing -1 where a size is expected becomes syntactically invalid.
That's perfectly valid syntax. It just won't typecheck or will fail at runtime.

Volte posted:

Begging the question.
So in other words, the whole thing is an overreaching runtime assertion that over-defines the meaning of "size".
This is nonsense posting.

Edit:

Volte posted:

Restricting the very notion of a size to be a positive integer seems like an unnecessarily heavy thing to do. It's one thing for a negative size to be invalid semantically, but its a whole other ballgame for it to be invalid syntactically. Negative sizes as arguments to an operation could easily be interpreted as an intention to perform the opposite operation (eg, shrink instead of grow), so why eliminate that option for seemingly no benefit?

edit: also you wouldn't be able to subtract two sizes and then use the result as a size, even though the (absolute) difference between two sizes is still intuitively a size

Do you even program? Sizes are already unsigned in C or C++ or other languages with size types.

sarehu fucked around with this message at 15:36 on Oct 6, 2015

Adbot
ADBOT LOVES YOU

Volte
Oct 4, 2004

woosh woosh

Blotto Skorzany posted:

It doesn't overdefine size, negative sizes are absurd and your proposed use for them to reverse operations is a dopey footgun
Depends on the language and the use case. Growing by a negative size being the same as shrinking is hardly a footgun...it's more like the definition of shrinking, or at least an identity. Another use would be to pass the size -1 as a sentinel, which you cannot deny is a common convention in languages that lack tagged unions.

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