Closed bradjc closed 9 years ago
I've thought about that, but I feel like it stands against the easy for
casual users to a degree. It becomes a lot of redundant typing. Part of the
reason people like JS / the web is that a naked setTimeout, toJSON, etc
"just work". There's a tradeoff space and I feel like an implicit from runtime import *
is the right tradeoff -- and yes, I recognize that this
runs counter to what I usually preach.
On Sun, Dec 7, 2014 at 7:17 AM, Brad Campbell notifications@github.com wrote:
Idea: namespace all accessor-specific functions within one namespace (maybe "runtime" or "rt" or "acc" or "art" or something). That way it would be really clear where a function was coming from (JS vs. accessor).
runtime.http.readURL(url); runtime.log.debug('Debug string'); runtime.error('Something broke');
— Reply to this email directly or view it on GitHub https://github.com/lab11/accessors/issues/8.
I think naked setTimeout, toJSON (which is a weird example because parsing JSON is JSON.parse()
), etc are what people hate about javascript, and that the reason that $ (jquery) and _ (underscore) exist is because people want consistent namespaced functions.
I argue that when reading other people's accessors (because that is how every one will be written: copy and edit) having all of the magic functions that only exist in accessor-land and not in normal javascript nicely identified will make understanding and looking up documentation way easier. Otherwise I have to start by guessing if something is in js documentation of accessor documentation.
And I will always trade off redundant typing if code is easier to understand.
I'm with you, but for that last sentence. There is a limit to that
principle, and it is Java. That said, I think a runtime scope probably is
the right choice. I think I like just calling it rt
so that common things
like rt.get
can be reasonably compact.
On Tue, Dec 9, 2014 at 12:32 AM, Brad Campbell notifications@github.com wrote:
I think naked setTimeout, toJSON (which is a weird example because parsing JSON is JSON.parse()), etc are what people hate about javascript, and that the reason that $ (jquery) and _ (underscore) exist is because people want consistent namespaced functions.
I argue that when reading other people's accessors (because that is how every one will be written: copy and edit) having all of the magic functions that only exist in accessor-land and not in normal javascript nicely identified will make understanding and looking up documentation way easier. Otherwise I have to start by guessing if something is in js documentation of accessor documentation.
And I will always trade off redundant typing if code is easier to understand.
— Reply to this email directly or view it on GitHub https://github.com/lab11/accessors/issues/8#issuecomment-66236984.
I think the argument is that Java does include a lot of redundant typing but it doesn't make code easier to understand and therefore is no good.
Ugh I really want to keep get()
set()
and get_parameter()
not namespaced but I think that will be confusing. Everything else feels like a library and those are just core mechanical functions - almost like if
or for
.
Well, it's actually a little confusing to call runtime.get()
, since it
isn't really the runtime that has the port (conceptually) it's the accessor
itself. From an intuition perspective, this.get()
almost makes more sense
to me. The other naked elements (version, log, subinit) are clearly things
that belong to the runtime. I'd actually be okay with leaving those three
unadorned.
On Tue, Dec 9, 2014 at 7:18 AM, Brad Campbell notifications@github.com wrote:
I think the argument is that Java does include a lot of redundant typing but it doesn't make code easier to understand and therefore is no good.
Ugh I really want to keep get() set() and get_parameter() not namespaced but I think that will be confusing. Everything else feels like a library and those are just core mechanical functions - almost like if or for.
— Reply to this email directly or view it on GitHub https://github.com/lab11/accessors/issues/8#issuecomment-66274332.
OK we are now using rt.
Idea: namespace all accessor-specific functions within one namespace (maybe "runtime" or "rt" or "acc" or "art" or something). That way it would be really clear where a function was coming from (JS vs. accessor).