rdfjs / N3.js

Lightning fast, spec-compatible, streaming RDF for JavaScript
http://rdf.js.org/N3.js/
Other
676 stars 127 forks source link

Usage of `import` as method names #380

Closed martines3000 closed 3 months ago

martines3000 commented 3 months ago

Hi. We are developing a project that is running inside a hardened JavaScript environment called SES (Secure EcmaScript) and this library is one of our sub-dependencies. SES doesn't allow overriding “reserved” keywords like import and this causes many issues for us.

My question is if it would be possible to maybe rename methods like this: https://github.com/rdfjs/N3.js/blob/51a41564467252278f4b8b5998453ad88f607ced/src/N3Store.js#L305 from import(stream) to something like _import(stream). This would solve our problems.

Thank you for the help.

RubenVerborgh commented 3 months ago

Hi @martines3000, we can't because this method name is prescribed by http://rdf.js.org/stream-spec/

Perhaps monkey patching (there exist npm tools for this) might help you out.

martines3000 commented 3 months ago

@RubenVerborgh Hi, thanks for the quick reply.

I am already doing that, but it is quite tedious as I need to patch multiple libraries and rebuild a some of them.

Is there maybe a way to raise the issue to the specification writers, as I think it is also not a good practice to use “reserved” keywords like that as method names?

RubenVerborgh commented 3 months ago

Indeed; the spec repository is part of this GitHub organization, would be good to raise it there.