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
Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Sapozhnik posted:

or does any sort of io at all really
i am continually frustrated that async filesystem io is basically not a thing

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

that's your fault for using Linux

a witch
Jan 12, 2017

IoCompletionPorts are the best part about windows.

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?
the Macintosh operating system supported async I/O pervasively when released in 1984: you set a pointer in your I/O parameter block and your call to perform some I/O would return immediately and your event loop could keep running, your function pointer would be called (at interrupt time) as soon as the I/O was complete or an error occurred

you could actually get decent throughput this way, though it was obviously more complex to program

unfortunately tons of developers learned C on time-shared UNIX systems in school and brought that brain damage with when they tried to program for the Mac, complaining both about both the lack of performance with synchronous I/O and the complexity of doing anything else

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
Barbarians Led By Bill Gates has a whole chapter about Gates's flip-out when he found out that Mac apps couldn't be auto-translated to Windows because of that

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?
first thing I’ve heard about it that makes me want to read it

I still love Hertzfield’s story about Gates’ wonder at the smoothness of the mouse pointer on Lisa & Macintosh, and his assumption it couldn’t be done without a hardware cursor

(the 6522 Versatile Interface Adapter is a magical chip, even the Apple II could do a smooth mouse cursor with one on the mouse card)

Carthag Tuek
Oct 15, 2005

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



holy poo poo "mouse card"

how far we have come

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

eschaton posted:

the Macintosh operating system supported async I/O pervasively when released in 1984: you set a pointer in your I/O parameter block and your call to perform some I/O would return immediately and your event loop could keep running, your function pointer would be called (at interrupt time) as soon as the I/O was complete or an error occurred

you could actually get decent throughput this way, though it was obviously more complex to program

unfortunately tons of developers learned C on time-shared UNIX systems in school and brought that brain damage with when they tried to program for the Mac, complaining both about both the lack of performance with synchronous I/O and the complexity of doing anything else
callback-based async is dumb and i'm glad it died

less glad that what replaced it is "no async at all" :smith:

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Come to Javascript where it's not just callback-based async, it's done with convention, no convention, promises and not, and now syntax sugar, so you can have a surprise every time you open up a codebase.

akadajet
Sep 14, 2003

Maluco Marinero posted:

Come to Javascript where it's not just callback-based async, it's done with convention, no convention, promises and not, and now syntax sugar, so you can have a surprise every time you open up a codebase.

yeah, the language supports cool stuff like async await. there's no reason to use inferior runtimes like .net anymore.

VikingofRock
Aug 24, 2008




e: nvm

VikingofRock fucked around with this message at 04:41 on Nov 4, 2017

Carthag Tuek
Oct 15, 2005

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



loving listen

you remember soundcards like soundblaster etc?

there used to be mouse cards apparently

akadajet
Sep 14, 2003

VikingofRock posted:

I still don't really get the difference between futures and promises in C++

i don't get why c++ is even a thing still

VikingofRock
Aug 24, 2008




akadajet posted:

i don't get why c++ is even a thing still

Well that post was particularly stupid because I looked it up and promise is a function which returns a future and I misremembered it. But you quoted it too fast!

akadajet
Sep 14, 2003

VikingofRock posted:

Well that post was particularly stupid because I looked it up and promise is a function which returns a future and I misremembered it. But you quoted it too fast!

the stupid thing is c++, not your post

VikingofRock
Aug 24, 2008




There's promise, future, async, and packaged_task and I always need to look them up before using them because I can never keep them straight

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

Maluco Marinero posted:

so you can have a surprise every time you open up a different file in the same codebase.

Turns out all the different async options fight with each other. You know, intermittently.

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?

Powaqoatse posted:

loving listen

you remember soundcards like soundblaster etc?

there used to be mouse cards apparently

yeah, there was this thing called a “bus mouse” for IBM PC clone users who had more slots to spare than serial ports

Lisa and Macintosh had the hardware to run a mouse built in, of course, as did the Apple //c and IIgs, and Apple made a mouse card for earlier Apple II systems that was basically just a VIA to handle counting the quadrature inputs and generating a VBL interrupt, and a ROM with the driver in it that knew how to turn that into screen coordinates

brap
Aug 23, 2004

Grimey Drawer
isnt it very easy in js to convert a method that takes a callback to a method that returns a promise, and if you have async/await support you can just await the promise?

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
it's easy to translate between asynchrony models if you understand both clearly & have had enough sleep, also easy to screw up massively

Gazpacho fucked around with this message at 07:11 on Nov 4, 2017

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
in my current soon to be former job i had to develop a script to make some WebRTC calls which could be callback based or promise based depending on the browser, but in any case the code needed to be promise-structured for maintainability even if the browser didn't support promises. so i ended up pulling a very small promise/A+ library and wrapping all the WebRTC results in A+ promises

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

fleshweasel posted:

isnt it very easy in js to convert a method that takes a callback to a method that returns a promise, and if you have async/await support you can just await the promise?

it’s straightforward to work with them if you know the in and the out, but when you’re working with several libraries all with their own stance on async, and you’re trying to pull it all together into code that is readable and user friendly, it all feels like mixing oil and water.

ecosystem, integration and large scale applications are where JavaScript is just a crapshoot. it’s why Typescript exists, to ease some of this because of how permissive the errors flow on beyond the actual mistake if they get into the runtime.

Carthag Tuek
Oct 15, 2005

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



eschaton posted:

yeah, there was this thing called a “bus mouse” for IBM PC clone users who had more slots to spare than serial ports

Lisa and Macintosh had the hardware to run a mouse built in, of course, as did the Apple //c and IIgs, and Apple made a mouse card for earlier Apple II systems that was basically just a VIA to handle counting the quadrature inputs and generating a VBL interrupt, and a ROM with the driver in it that knew how to turn that into screen coordinates

lol pure madness. Amigas handled mice fine too

i wonder how well a mouse worked in GeOS on the c64. I only had joysticks at the time and moving a cursor around with a joystick was pretty bad so i never used it much

Xarn
Jun 26, 2015

VikingofRock posted:

There's promise, future, async, and packaged_task and I always need to look them up before using them because I can never keep them straight

I always found the first three easy enough

You promise to eventually provide a value
You can get a value in the future
You can ask someone else to do the work asynchronously with you...


I had to look up packaged task :v:

Sapozhnik
Jan 2, 2005

Nap Ghost

Gazpacho posted:

in my current soon to be former job i had to develop a script to make some WebRTC calls which could be callback based or promise based depending on the browser

:psyduck:

how the gently caress did that happen, webrtc got standardized way after the standard Promise object did

(it's IE, isn't it. It's always IE)

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Sapozhnik posted:

:psyduck:

how the gently caress did that happen, webrtc got standardized way after the standard Promise object did

(it's IE, isn't it. It's always IE)
It was prototyped before it was standardized. In Firefox iirc

Suspicious Dish
Sep 24, 2011

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

Sapozhnik posted:

:psyduck:

how the gently caress did that happen, webrtc got standardized way after the standard Promise object did

(it's IE, isn't it. It's always IE)

google bought webrtc from some other company, copy/pasted it into chrome wholesale and put a "webkit" prefix before it. they then had their dev evangelist teams push it heavily and rushed it through standardization. no browsers bothered with es6 promises at that time because they were easily polyfilled. so sure, it was standardized later, but the implementation order was the reverse.

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?

Gazpacho posted:

Barbarians Led By Bill Gates has a whole chapter about Gates's flip-out when he found out that Mac apps couldn't be auto-translated to Windows because of that

ty again for the recommendation, it’s interesting if very obviously biased and somewhat amateurishly written and typeset

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Suspicious Dish posted:

google bought webrtc from some other company, copy/pasted it into chrome wholesale and put a "webkit" prefix before it. they then had their dev evangelist teams push it heavily and rushed it through standardization. no browsers bothered with es6 promises at that time because they were easily polyfilled. so sure, it was standardized later, but the implementation order was the reverse.

webrtc is trash so microsoft had to create objectrtc and since google is the de facto web monopoly nobody else implemented it

Cybernetic Vermin
Apr 18, 2005

Suspicious Dish posted:

google bought webrtc from some other company, copy/pasted it into chrome wholesale and put a "webkit" prefix before it. they then had their dev evangelist teams push it heavily and rushed it through standardization. no browsers bothered with es6 promises at that time because they were easily polyfilled. so sure, it was standardized later, but the implementation order was the reverse.

it was all strategically important for google though, to accelerate their introducing/deprecating cycle for chat systems from almost 2 years down to a planned 36 minutes by 2019

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Malcolm XML posted:

webrtc is trash so microsoft had to create objectrtc and since google is the de facto web monopoly nobody else implemented it
what's wrong with webrtc

akadajet
Sep 14, 2003

Ralith posted:

what's wrong with webrtc

it gave us chatroulette

Suspicious Dish
Sep 24, 2011

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

Workaday Wizard
Oct 23, 2009

by Pragmatica
can wasm do things js can not do?

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

akadajet posted:

it gave us chatroulette
That was Flash.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
i meant to make a bigger effortpost but just wanted to prime the posting gears by writing "webassembly"

*cough*

webassembly, for those who don't know, is the next jesus savior to the modern web after flexbox (which now everybody hates in favor of css grids) and react (which now everybody hates in favor of vue.js). the promise is high: a generic bytecode vm that any language can target.

in reality, webassembly shares more in common with asm.js than it does java or python. basically, it's a winamp skin for asm.js: instead of your instructions being represented in javascript form, they get represented in bytecode form. that is practically the only difference. the execution model and type system is still the same: you get a giant gently caress-off array full of floats and ints, and anything else is bolted on top of that.

what people don't know is that 90% of what you do in webassembly is actually provided by a bunch of javascript support runtime code in emscripten. like, that unity tanks demo? that relies on this 8,000 piece of poo poo desktopgl-to-webgl wrapper because nobody has any good ideas on the web

https://github.com/kripken/emscripten/blob/incoming/src/library_gl.js

choice quote:

// When user GL code wants to render from client-side memory, we need to upload the vertex data to a temp VBO
// for rendering. Maintain a set of temp VBOs that are created-on-demand to appropriate sizes, and never destroyed.
// Also, for best performance the VBOs are double-buffered, i.e. every second frame we switch the set of VBOs we
// upload to, so that rendering from the previous frame is not disturbed by uploading from new data to it, which
// could cause a GPU-CPU pipeline stall.

if you know anything about opengl you know what a horrible idea this is. thanks, emscripten.




ok but onto the actual topic of today. recently, there's a proposal for "opaque reference types" because they originally started bolting on their javascript gc before they realized that nobody loving wants that. i read through it, struggle to understand it, and so i post some issues on the issue tracker, hoping that the people that are much smarter than i am that made the proposal have an answer

today i want to share with you one of those issues i filed. host bindings allow someone to reference, say, a DOMElement in webassembly and call things on it. the way this works is that there's a shitton of "tables", one for each type you want to call, and there's an allocation strategy for how these tables get filled up.

here's a quote from the spec:

For freeing slots, no explicit mechanism is provided. But the assumption is that global containing a pending free slot can be set prior to function return, which will get released on the next allocation. NOTE: This does have the side-effect of holding a reference to the last returned value of each type until the module is re-entered through a path that triggers the actual free.

spot the very obvious problem with this issue, besides the NOTE provided. hint: the pending free slot isn't "top of stack" or similar, it's pointing to one slot index.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Suspicious Dish posted:

basically, it's a winamp skin for asm.js

lmbo

mystes
May 31, 2006

Shinku ABOOKEN posted:

can wasm do things js can not do?
Blah blah blah turing completeness. But in reality it will make it a lot more practical to replace desktop applications for a lot of stuff.

Workaday Wizard
Oct 23, 2009

by Pragmatica

mystes posted:

Blah blah blah turing completeness. But in reality it will make it a lot more practical to replace desktop applications for a lot of stuff.

yes but what mechanisms does it have that javascript lacks? can you do x in wasm but not in javascript? what do you gain from wasm that you can’t gain by transpiling?

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

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



Shinku ABOOKEN posted:

yes but what mechanisms does it have that javascript lacks? can you do x in wasm but not in javascript? what do you gain from wasm that you can’t gain by transpiling?

i would hope one less layer of translation but from what suspicious dish says it doesnt sound like it lol

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