Comments (11)
@dobrite this is why you cannot turn on global strict mode.
You must turn on strict mode at a per file level.
from error.
In regards to a global use strict
. The code I wrote is not doing this. Should I take it up with cyclejs then?
I do feel that a utility library should adhere to strict mode, in this case skipping the name
property and instead using an alternate property (_name
in your case). It is already a no-op on at least chrome.
In any case thanks for the quick response and happy new year! 🎉
from error.
Interestingly the problem you described doesn't exist in node but exists in chrome.
from error.
I can reproduce the problem in node 0.11.x
still error
itself doesn't use strict mode so unless you use global strict mode this shouldn't happen.
For example
> function foo() { 'use strict'; function g() {}; g.name = 'bar'; return g; }
undefined
> foo()
TypeError: Cannot assign to read only property 'name' of function g() {}
at foo (repl:1:56)
at repl:1:1
at REPLServer.defaultEval (repl.js:130:27)
at bound (domain.js:257:14)
at REPLServer.runBound [as eval] (domain.js:270:12)
at REPLServer.<anonymous> (repl.js:277:12)
at REPLServer.EventEmitter.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:202:10)
at REPLServer.Interface._line (readline.js:531:8)
at REPLServer.Interface._ttyWrite (readline.js:812:14)
> function foo() { function g() {}; g.name = 'bar'; return g; }
undefined
> foo()
[Function: g]
> function fab() { 'use strict'; return foo(); }
undefined
> fab()
[Function: g]
from error.
I updated my comment above (sorry). Since it already is a no-op on Chrome error
and extend
shouldn't rely on it working. Perhaps skip the name
property with extend
? That way strict doesn't throw and _name
is set for whatever nefarious purposes you have 😁
from error.
@dobrite I can skip the name
property but that requires an extra copy and a delete.
I'm taking advantage of the fact that assigning name
is a no-op so I dont have to write more code or do more copies.
from error.
@dobrite how exactly are you using webpack and cycle together ?
from error.
It's just cyclejs''s README code and a minimal package.json
and webpack config to get it going.
I have to run out the door but I'll throw up a repo later. cheers!
from error.
Might be related to Raynos/xtend#25
from error.
I think webpack might be enforcing a global 'use strict' then. Cycle.js doesn't do that, it uses strict per file only.
from error.
So the issue was es6-loader
in the webpack config I was using. es6-loader
uses es6-module-transpiler
and es6-transpiler
, the former of which enforces use strict
on es6 modules. A few different threads turned up that es6 modules, by definition, always enforce strict semantics (TIL!).
I think I can get by with excluding node_modules
from es6-loader
.
I apologize for the issues as it ultimately was not your libraries. Thank you both for your help! Cheers 🍻
from error.
Related Issues (11)
- Add warning for 'illegal access' in node < 0.12 HOT 1
- use captureStackTrace for v8 HOT 3
- checking err is SomeTypedError? HOT 1
- Don't require `assert` module HOT 2
- TypeError: "name" is read-only HOT 1
- v7.0.2 is missing on github HOT 3
- [Request/Question] TypeScript definitions HOT 13
- Request: Default template string HOT 1
- License file missing
- What Even Is `MIGRATION.md`? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from error.