Fork me on GitHub

does anybody here happen to know why async function s in javascript tend to use const to store intermediate results? like


const verifyUser = async function(username, password){
   try {
       const userInfo = await dataBase.verifyUser(username, password);
       const rolesInfo = await dataBase.getRoles(userInfo);
       const logStatus = await dataBase.logAccess(userInfo);
       return userInfo;
   }catch (e){
       //handle errors as needed


Short for constant? My JavaScript is a little rusty.


I think they cannot be re-assigned.


yeah, const is something "new" in JS, they also use it for (destructuring) requires: const { evalString, toJS } = require("@borkdude/sci");


const has nothing to do with async. You can use const, you can use let there. Up to you. If you can use const, it's better to use it.


huh. what are the semantics there though? it seems super weird to have a scoped constant


it means you can't overwrite the value later


in whatever scope it's defined


maybe the (some) JS compiler(s) also uses it for making optimizations?


gotcha. huh. weirdly enough it looks like you can change properties of objects declared as const lol


yeah, it doesn't make objects immutable, just not re-assignable


yeah JS has a lot of holes it prevents re-binding but not mutation


I think it's basically like final in Java


ahh, thats a good way to think of it


If you find something strange in JS, try not to dwell on it too much. :) Helps against getting headaches.

💯 8

its a scoped unreassignable reference


I use const by default in JS, and only downgrade to let in the rare case it's the only way to accomplish the task


I guess it's a bit like Some(null) in Scala, but different 😛


nice. Well thanks! And thanks to all you folks at home for participating in this weeks episode of JS why u so crazy?

Alex Miller (Clojure team)16:02:01

it's weird when data isn't immutable by default, isn't it?

👍 8

what if the original designer of JS had gotten 4 weeks instead of 2 to get it done before the first release... or 2 years


🦇👨 <- your daily dose of obscure references. :)


ugh, don't remind me. I'm interviewing for a primarily Nodejs job today. It'll take me a while to infiltrate their enclave of trust and infect them with cljs


so for now, its JS all the way down


what if browsers supported CLJS natively! </keeps dreaming>


Or even CLJ.


WASM compatibility for the JVM...?


someone has experimented with converting wasm to jvm bytecode:


it's not jvm, but there is some effort by the graal folks to do some wasm stuff too


I googled earlier and found "TeaVM" for the opposite direction, JVM -> WASM. It doesn't look near release though


i guess at this point a lot of wasm stuff is like that


the answer to the former question is that if he had more time, his bosses would've insisted even more that his scheme for the browser be rewritten to look like an oracle product :(


probably the only reason cljs is possible at all is because he only had 2 weeks to bastardize it lol


it's delightfully pointless


I love how that totally obliterates the back button 😂


does anybody have any experience with negotiating intellectual property clauses in employee agreements?


this one states that all thoughts belong to the employer for those thoughts that I "conceive, develop, make, reduce to practice or acquire in performing contract services under this Agreement" I feel like thats a little vague and I don't want to limit my ability to contribute to or create open source software in my spare time. Id prefer it be a bit more specific but i need a template to negotiate from

Alex Miller (Clojure team)23:02:56

I have experience with refusing to sign garbage like that :)


yeah says alex miller with a resume that laughs at mine

Alex Miller (Clojure team)23:02:46

Seriously though, this is crap lawyers make

Alex Miller (Clojure team)23:02:10

You can ask for an addendum that clarifies

Alex Miller (Clojure team)23:02:49

Your hiring manager wants to hire people and does not generally like that stuff any more than you


yeah, I agree. I'm looking for examples of employee friendly language that doesn't completely compromise the intent of the agreement

Alex Miller (Clojure team)23:02:37

Just state what you have above - the employees work on open source projects outside work areas does not belong to the employer. Something like that

Alex Miller (Clojure team)23:02:40

My experience is that companies are more flexible than you expect on this stuff


another one is that I'm working for a company that does some NLP and thats an area of research I'm actively interested in participating in. My role is just to prepare and deploy the data for the model, not the development of the model. Id like to make sure that if I develop models on my own I can publish them or profit from them or open source them


ooh, looks like Github has a published standard called the Balanced Employee IP Agreement

👀 4