freenode/#sbcl - IRC Chatlog
Search
9:55:16
phoe
to sum up: is it expected that cl:file-position on a Gray stream signals a n-a-m instead of returning something meaningful?
10:56:40
Krystof
I think the implementor of the Gray Stream class is responsible for defining a method on stream-file-position. This is a minor incompatible change; we used to have a catch-all method that did nothing, but that doesn't seem entirely right
10:59:01
phoe
the "doesn't seem entirely right" part was about it returning NIL even for non-streams IIRC
10:59:49
phoe
the original Gray proposal did not include stream-file-position at all, so we can't use that as a reference point
11:00:32
Krystof
Yes. The fact remains that the implementor of the Gray stream is able to write an appropriate file-position for their Gray stream, in a way that no catch-all method can
11:00:55
phoe
the thing is that FILE-POSITION is defined to return nil/false in case that no meaningful return value/position setting takes place, so I actually think that having a default method always that returns NIL for all streams would make sense
11:01:10
phoe
if someone wants to write a method that actually does something meaningful, then they can override that default
11:01:45
phoe
my interpretation comes from the way FILE-POSITION is defined - if passed a stream object, no matter what stream object it is, it's supposed to return a position or NIL, or true/false if setting was requested
11:02:15
Krystof
right, in the same way that if you call read-char on a stream, it should return a character (but if you haven't implemented stream-read-char, it won't)
11:02:56
Krystof
it's a protocol; you have to implement the things together to make the protocol work. A default method that does nothing *might* be a convenience or *might* obscure bugs, who knows?
11:03:32
phoe
if that's what SBCL decides, could I ask for a comment on that issue so we can bounce the ball back to slime? or should we do the formalisms some other way?
11:04:30
Krystof
I wish that I had caught the incompatibility when I was writing the NEWS for that release, but... since there's nothing that I can see that says that this default method must exist, I think it is robust and safe to always have an implementation for it in the Gray Stream