Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify mix require #4283

Merged
merged 2 commits into from Jun 1, 2017
Merged

Simplify mix require #4283

merged 2 commits into from Jun 1, 2017

Conversation

JeffreyWay
Copy link
Contributor

Note that I left your dang const as it is, even though it's stupid. let for life. 💃💃💃💃

Note that I left your dang `const` as it is, even though it's stupid. `let` for life. 💃💃💃💃
@joshmanders
Copy link
Contributor

Yo I'mma let you PR this, but const is the best keyword of all time. Of. All. Time.

@taylorotwell taylorotwell merged commit e50ca3d into master Jun 1, 2017
@taylorotwell
Copy link
Member

Thanks <3

@JeffreyWay JeffreyWay deleted the mix-patch branch June 1, 2017 20:43
@xargr
Copy link

xargr commented Jul 18, 2017

@taylorotwell i think const is better solution than let becuse require is immutable.. perhaps...

@JeffreyWay
Copy link
Contributor Author

JeffreyWay commented Jul 19, 2017 via email

@joshmanders
Copy link
Contributor

const is visual debt, @xargr. Get out of our faces with that shizzle!

@xargr
Copy link

xargr commented Jul 19, 2017

constant cannot change through re-assignment, and it can't be redeclared... i have saw over 10 tutorial for js framework and all developer uses const in require statement

@JeffreyWay
Copy link
Contributor Author

I don't like const because it makes you assume that the value is immutable, when it's not.

https://www.dropbox.com/s/gnrz1r4nu0nkg5b/Screenshot%202017-07-19%2011.52.55.png?dl=0

It makes zero difference in this file. var would be equally fine.

@matthewlilley
Copy link

matthewlilley commented Jul 19, 2017

However, it does not allow the rebinding of that variable. Whereas let does.

The question here is "Does mix ever need to be rebound?"

@TuzBot
Copy link

TuzBot commented Jul 19, 2017

I do agree with you @JeffreyWay but const does have slight immutability, at the very least in the example you have just attached.
Although you can change the value's of const person's properties you can't change person from an being Object when it was assigned, giving abit of clarity as to what type the variable is/intended/has to be to be used.

const

@JeffreyWay
Copy link
Contributor Author

I think "slight immutability" is an oxymoron. :)

I use let for everything. Anyways, like I said it doesn't matter here. Zero people will reassign the mix variable.

@matthewlilley
Copy link

I think const should be default if no rebinding if needed. And aside from that, It's good to get into a habit of using the most appropriate variable keyword, more importantly, distinguishing the two.

@joshmanders
Copy link
Contributor

I think bike-shedding is not really ideal, and if you don't want to use let just update it in your own webpack.mix.js file and be done with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants