Closed FND closed 6 years ago
Overall, LGTM 👍. Whether it should be a plain log or an error log statement I think we should decide later. This may be more obvious with actual demand in place.
simpleLog
function be injected by the execution environment?Thanks for the feedback!
I think this is a warning, not an error.
I see your point, and indeed I'm not entirely sure myself: OTOH it's invalid HTML, but OTOH HTML is intended to be fault-tolerant. And yet, an error log message is not an exception, so ... I remain uncertain. 😕 (I like @mechanoid's suggestion, but not sure whether that'd be a cop-out.)
Shouldn't the simpleLog function be injected by the execution environment?
You mean like global.simpleLog
? To what end? (Note that simpleLog
is just the default value for the log
function - which would typically be passed into the root element generator to kick off rendering.
I think performance is a topic we should discuss in general.
Yes, indeed. However, that depends in large part on the respective adaptor (e.g. V8 vs. Nashorn, but also efficiency WRT things like the JavaScript engine's persistence vs. evaluation from scratch).
I'm guessing that the respective adaptor/environment plays a much bigger role than any potential optimizations within complate-stream, so I'll choose not to worry about micro-optimizations here and now. (Also, I'm guessing that we won't have any problems competing with Haml's performance either way, so whatever we do here should be good enough.)
I oversaw the default-ness of the simpleLog function at first myself. I like that it is stupid and simple for those defaults. We should not overthink such things, again, without having any demand. And I don't see it as a cop-out. I think we all are happy and open for discussion once there is someone that asks.
I went ahead and merged this, addressing #2 in the process - I'd still like to get consensus on the issues above (log level and, if the above didn't address it, default logger) before making a release though.
67fcc1a75dcb64945112fefebe2b33394dd49b92 fixes the logger not being passed through to child elements:
this was overlooked in b6bec9d2b4a8f44103e4e47fccd1a5161b0f61f8 - which worries me a little, as it suggests that this way of passing around parameters (which is the way of functional programming) is kinda brittle
😕
On the bright side, these changes made it fairly easy to not just balk at non-empty void elements (#2 / a9844b73d24d56196c5ef7df6ad769019c803b95), but also to flag duplicate IDs (1f674aec4e3a84e72f5af5216117548abf205eb0).
1311e58c9f41e61bea6da4c76366ed1cf53b0244
this should also make optional ID validation a little easier
WritableStream
toBufferedStream
and consider exposing it withinsrc