Well, your method with the object as the second argument seems good, but I'd remove includesDefaultLineHandler and would just always add lineHandler as a field in the gps structure instead...
I don't think renaming internal things would cause problems - they'll probably just be minified anyway. I'd try not to use long variable/function names though (while still trying to keep them informative and readable).
In terms of modules:
They need to provide a simple way to access the device in question
The audience is 95% of users, with extensibility where it can be added without much overhead. If you know what you're doing you can always just modify the existing module, but if the module is so focussed on extensibility that nobody can understand it, I think it's failed.
Can you give an example of what you'd consider a 'lambda-oriented structure?'
Just to clear up my thinking here, if given the following choices:
Write clear, simple code that is easy to understand and modify, but doesn't do everything.
Write complicated but extensible code, and then document it extensively so that people can extend it without touching the original code.
I think the first option is the right one for Espruino.
Espruino straddles a difficult line - it's trying to be easy to use, but it is a microcontroller with very limited storage. I don't think we should waste that storage on functionality that most people won't use when they pull in the module.
About the addition of the tag: Yes, it'd be compatible - but I don't think you should add it. If you're extending the GPS module yourself, why can't you just add it if you need it? Otherwise for everyone else it's just wasting their memory.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well, your method with the object as the second argument seems good, but I'd remove
includesDefaultLineHandler
and would just always addlineHandler
as a field in thegps
structure instead...I don't think renaming internal things would cause problems - they'll probably just be minified anyway. I'd try not to use long variable/function names though (while still trying to keep them informative and readable).
In terms of modules:
Just to clear up my thinking here, if given the following choices:
I think the first option is the right one for Espruino.
Espruino straddles a difficult line - it's trying to be easy to use, but it is a microcontroller with very limited storage. I don't think we should waste that storage on functionality that most people won't use when they pull in the module.
About the addition of the tag: Yes, it'd be compatible - but I don't think you should add it. If you're extending the GPS module yourself, why can't you just add it if you need it? Otherwise for everyone else it's just wasting their memory.