Closed sikefield3 closed 1 year ago
Thanks! In this location, FloatValueOf
should be used since values might also be strings, lists or other atoms. The strict type-checking was added after this example was written. The type checking error message should be improved, I guess...
I'm trying to fix all this now.
The first half of the fix is in afce40e7f6863f4017eb10d35f6231c5e8d214e6 and this just changes the example to use FloatValueOf
The second half of the fix is in ded13fb1b8a884c178e6bb80e6c19ec97ef7daaf and this requires the AtomSpace to be recompiled and reinstalled. This one declares that StreamValueOf
(lower down in the example) can return numbers, thus keeping the arithmetic links happy about the types they are getting.
Static typing seems like a great idea, but it sure does cause pain. On the other hand runtime typechecking is hard to debug, when the types are wrong. Pick your poison...
https://github.com/opencog/atomspace/blob/7518fd6368ac1334bb1e4b8ffa1eac2734e5b336/examples/atomspace/stream.scm#L32
If I try this demo (as suggested by pasting into the scheme prompt), I get the following exception:
There is a similar line below this, which gives the same error.
It could be in my environment (missing library or something...), but it doesn't look like that, since I have only encountered one other issue: A segmentation fault in a demo that makes use of two atomspaces, which seems unrelated to me.