Closed raimohanska closed 10 years ago
In fd95c4ba00218292f53e17948db61be404a62364, I've implementated and tested a lot of toString implementations... Still some combinators left.
My feeling is that this might be worth the effort :)
Most of the work is already done in the branch feature/dependency-graph-dispatch.
Todo: specs for the rest of the combinators.
I'm planning to include this in release 0.7.0. Help is appreciated!
Whoa. Just squeezed the toString implementations in.
So, this stuff is ready for release, and resides currently in the feature/dependency-graph-dispatch
branch.
This is actually a comeback of #107.
@dnalot @hden @RoboTeddy any comments? Should we include .inspect
too?
Hmm.. When running in CoffeeScript, the new toString doesn't seem to work:
var Bacon=require("./dist/Bacon")
coffee> Bacon._.toString({a:"b"})
'[object Object]'
This is weird, as the tests pass quite well and they are done in coffee too.
It seem to be only happing in the REPL. Perhaps its a compiler issue?
# test.coffee
'use strict'
Bacon = require "./dist/Bacon"
console.log Bacon._.toString({a:"b"})
# shell
$ coffee test.coffee
{a:b}
# REPL
> Bacon = require "./dist/Bacon"
...
> console.log Bacon._.toString({a:"b"})
[object Object]
Yeah, I think it's Node.js, see e.g. http://stackoverflow.com/questions/7428235/how-to-print-json-object-content-in-node-js How come it's an object, not a string?
On Mon, Nov 4, 2013 at 2:10 AM, Hao-kang Den notifications@github.comwrote:
It seem to be only happing in the REPL. Perhaps its a compiler issue?
test.coffee'use strict'Bacon = require "./dist/Bacon"console.log Bacon._.toString({a:"b"})
shell
$ coffee test.coffee {a:b}
REPL
Bacon = require "./dist/Bacon" ... console.log Bacon._.toString({a:"b"}) [object Object]
— Reply to this email directly or view it on GitHubhttps://github.com/baconjs/bacon.js/issues/265#issuecomment-27659933 .
It seems that this problem is fixed in the current master of coffee-script. Ready to close this issue?
The implementation is now in feature/0.7 and will be included in the 0.7.0 release.
One more thing: should we support .inspect()
also?
I'm thinking about supporting toString/inspect for the following:
Should have tests for all of the included objects/classes.
Added a name
method as @rassie suggested in #273.
Also implemented inspect
for nice node output.
Now you can
> B.once("1").name("one")
one
> B.once(1).name("stuff").take(1)
stuff.take(1)
I'm done with this one!
How about a
toString()
function that would return something like this:or
A quick implementation exists at 30ae4aa1ef0a64bc42fbe61cb6bb736a4f1bbe98. And when I say quick I mean that all tests for toString are missing at the moment.