Fork me on GitHub
#off-topic
<
2020-02-18
>
idiomancy15:02:52

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

idiomancy15:02:58

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
   }
};

hindol15:02:50

Short for constant? My JavaScript is a little rusty.

hindol15:02:02

I think they cannot be re-assigned.

borkdude15:02:15

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

p-himik15:02:22

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.

idiomancy15:02:19

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

mloughlin15:02:01

it means you can't overwrite the value later

mloughlin15:02:13

in whatever scope it's defined

borkdude15:02:26

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

idiomancy15:02:56

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

borkdude15:02:14

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

mloughlin15:02:30

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

markmarkmark15:02:58

I think it's basically like final in Java

idiomancy16:02:18

ahh, thats a good way to think of it

p-himik16:02:21

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

💯 8
idiomancy16:02:26

its a scoped unreassignable reference

mloughlin16:02:08

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

borkdude16:02:13

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

idiomancy16:02:30

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
borkdude16:02:21

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

p-himik16:02:28

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

idiomancy16:02:46

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

idiomancy16:02:54

so for now, its JS all the way down

borkdude16:02:40

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

p-himik16:02:58

Or even CLJ.

mloughlin16:02:53

WASM compatibility for the JVM...?

sogaiu22:02:56

someone has experimented with converting wasm to jvm bytecode: https://renato.athaydes.com/posts/running-wasm-on-the-jvm.html

sogaiu22:02:15

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

mloughlin22:02:55

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

sogaiu23:02:40

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

idiomancy16:02:58

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 :(

idiomancy16:02:38

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

mloughlin16:02:09

it's delightfully pointless

idiomancy16:02:17

I love how that totally obliterates the back button 😂

idiomancy23:02:46

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

idiomancy23:02:56

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 :)

idiomancy23:02:26

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

idiomancy23:02:01

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

idiomancy23:02:06

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

idiomancy23:02:30

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

👀 4