From avodonosov at yandex.ru Sat Mar 9 23:54:28 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 10 Mar 2013 03:54:28 +0400 Subject: [trivial-gray-streams-devel] trivial-gray-stream-mixin in cl+ssl In-Reply-To: References: Message-ID: <1809401362873268@web18e.yandex.ru> Hello James, Thanks for the report. Indeed, unpleasant subtle issue. You are on CLISP or CCL, right? I am thinking how to fix it in trivial-gray-streams. If it will be impossible/difficult, then I will just fix cl+ssl as you suggests. Forwarding to both mailing lists for now. Best regards, - Anton 10.03.2013, 00:10, "James M. Lawrence" : > Hello, I noticed that cl+ssl has the same issue that I recently had > with gray streams. > > (defclass my-stream > ????(trivial-gray-streams:fundamental-binary-input-stream > ?????trivial-gray-streams:fundamental-binary-output-stream > ?????trivial-gray-streams:trivial-gray-stream-mixin) > ??()) > > (defmethod trivial-gray-streams:stream-write-byte > ????((stream my-stream) byte) > ??(format t "~&write-byte ~s~%" byte)) > > (defmethod trivial-gray-streams:stream-write-sequence > ????((stream my-stream) seq start end &key) > ??(format t "~&write-sequence ~s ~s ~s~%" seq start end)) > > (defun test () > ??(write-sequence #(3 4 5) (make-instance 'my-stream))) > > CL-USER> (test) > write-byte 3 > write-byte 4 > write-byte 5 > > The mixin should be the first superclass. With that change, we get > > CL-USER> (test) > write-sequence #(3 4 5) 0 3 > > Best, > James From avodonosov at yandex.ru Sun Mar 10 06:42:53 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 10 Mar 2013 10:42:53 +0400 Subject: [trivial-gray-streams-devel] [cl-plus-ssl-devel] trivial-gray-stream-mixin in cl+ssl In-Reply-To: <1809401362873268@web18e.yandex.ru> References: <1809401362873268@web18e.yandex.ru> Message-ID: <773771362897773@web16e.yandex.ru> Fixed cl+ss by changing (defclass ssl-stream (fundamental-binary-input-stream fundamental-binary-output-stream trivial-gray-stream-mixin) to (defclass ssl-stream (trivial-gray-stream-mixin fundamental-binary-input-stream fundamental-binary-output-stream) Further discussion of fixing trivial-gray-streams will happen on trivial-gray-streams-devel. Best regards, - Anton 10.03.2013, 04:08, "Anton Vodonosov" : > Hello James, > > Thanks for the report. > > Indeed, unpleasant subtle issue. You are on CLISP or CCL, right? > > I am thinking how to fix it in trivial-gray-streams. If it will be impossible/difficult, > then I will just fix cl+ssl as you suggests. > > Forwarding to both mailing lists for now. > > Best regards, > - Anton > > 10.03.2013, 00:10, "James M. Lawrence" : > >> ?Hello, I noticed that cl+ssl has the same issue that I recently had >> ?with gray streams. >> >> ?(defclass my-stream >> ?????(trivial-gray-streams:fundamental-binary-input-stream >> ??????trivial-gray-streams:fundamental-binary-output-stream >> ??????trivial-gray-streams:trivial-gray-stream-mixin) >> ???()) >> >> ?(defmethod trivial-gray-streams:stream-write-byte >> ?????((stream my-stream) byte) >> ???(format t "~&write-byte ~s~%" byte)) >> >> ?(defmethod trivial-gray-streams:stream-write-sequence >> ?????((stream my-stream) seq start end &key) >> ???(format t "~&write-sequence ~s ~s ~s~%" seq start end)) >> >> ?(defun test () >> ???(write-sequence #(3 4 5) (make-instance 'my-stream))) >> >> ?CL-USER> (test) >> ?write-byte 3 >> ?write-byte 4 >> ?write-byte 5 >> >> ?The mixin should be the first superclass. With that change, we get >> >> ?CL-USER> (test) >> ?write-sequence #(3 4 5) 0 3 >> >> ?Best, >> ?James > > _______________________________________________ > cl-plus-ssl-devel mailing list > cl-plus-ssl-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/cl-plus-ssl-devel From trivial-gray-streams-devel_common-lisp.net at sumou.com Sun Mar 10 15:27:39 2013 From: trivial-gray-streams-devel_common-lisp.net at sumou.com (=?UTF-8?Q?=E7=99=BD=E3=81=84=E7=86=8A?=) Date: Sun, 10 Mar 2013 19:27:39 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation Message-ID: <5e6efdf62926255017e4bc1f157460a6@hcoop.net> Hello: I want to install trivial-gray-streams via asdf. (asdf:load-system 'trivial-gray-streams) ... WHEN: variable #1=#:STREAM-READ-SEQUENCE has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE] Restarts: 0: [USE-VALUE] Input a value to be used instead of #:STREAM-READ-SEQUENCE. 1: [STORE-VALUE] Input a new value for #:STREAM-READ-SEQUENCE. 2: [TRY-RECOMPILING] Try recompiling mixin 3: [RETRY] Retry compiling component ("trivial-gray-streams" "mixin"). 4: [ACCEPT] Continue, treating compiling component ("trivial-gray-streams" "mixin") as having been successful. 5: [*ABORT] Return to SLIME's top level. I'm trying to decipher what the problem is, but haven't succeeded. What's going wrong? -- ??? From avodonosov at yandex.ru Sun Mar 10 19:38:54 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 10 Mar 2013 23:38:54 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation In-Reply-To: <5e6efdf62926255017e4bc1f157460a6@hcoop.net> References: <5e6efdf62926255017e4bc1f157460a6@hcoop.net> Message-ID: <672541362944334@web15e.yandex.ru> Hello. What lisp implementation do you use, and what version of trivial-gray-streams (were you downloaded it)? 10.03.2013, 20:12, "???" : > Hello: > > I want to install trivial-gray-streams via asdf. > > (asdf:load-system 'trivial-gray-streams) > ... > WHEN: variable #1=#:STREAM-READ-SEQUENCE has no value > ????[Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE] > > Restarts: > ??0: [USE-VALUE] Input a value to be used instead of > #:STREAM-READ-SEQUENCE. > ??1: [STORE-VALUE] Input a new value for #:STREAM-READ-SEQUENCE. > ??2: [TRY-RECOMPILING] Try recompiling mixin > ??3: [RETRY] Retry compiling component ("trivial-gray-streams" "mixin"). > ??4: [ACCEPT] Continue, treating compiling component > ("trivial-gray-streams" "mixin") as having been successful. > ??5: [*ABORT] Return to SLIME's top level. > > I'm trying to decipher what the problem is, but haven't succeeded. > What's going wrong? > -- > ??? > > _______________________________________________ > trivial-gray-streams-devel mailing list > trivial-gray-streams-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/trivial-gray-streams-devel From avodonosov at yandex.ru Sun Mar 10 19:40:53 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 10 Mar 2013 23:40:53 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation In-Reply-To: <672541362944334@web15e.yandex.ru> References: <5e6efdf62926255017e4bc1f157460a6@hcoop.net> <672541362944334@web15e.yandex.ru> Message-ID: <673581362944453@web15e.yandex.ru> Although maybe I know. Is it CLISP and the fresh git version? 10.03.2013, 23:39, "Anton Vodonosov" : > Hello. > > What lisp implementation do you use, and what version of trivial-gray-streams (were you downloaded it)? > > 10.03.2013, 20:12, "???" : > >> ?Hello: >> >> ?I want to install trivial-gray-streams via asdf. >> >> ?(asdf:load-system 'trivial-gray-streams) >> ?... >> ?WHEN: variable #1=#:STREAM-READ-SEQUENCE has no value >> ?????[Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE] >> >> ?Restarts: >> ???0: [USE-VALUE] Input a value to be used instead of >> ?#:STREAM-READ-SEQUENCE. >> ???1: [STORE-VALUE] Input a new value for #:STREAM-READ-SEQUENCE. >> ???2: [TRY-RECOMPILING] Try recompiling mixin >> ???3: [RETRY] Retry compiling component ("trivial-gray-streams" "mixin"). >> ???4: [ACCEPT] Continue, treating compiling component >> ?("trivial-gray-streams" "mixin") as having been successful. >> ???5: [*ABORT] Return to SLIME's top level. >> >> ?I'm trying to decipher what the problem is, but haven't succeeded. >> ?What's going wrong? >> ?-- >> ???? >> >> ?_______________________________________________ >> ?trivial-gray-streams-devel mailing list >> ?trivial-gray-streams-devel at common-lisp.net >> ?http://lists.common-lisp.net/cgi-bin/mailman/listinfo/trivial-gray-streams-devel > > _______________________________________________ > trivial-gray-streams-devel mailing list > trivial-gray-streams-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/trivial-gray-streams-devel From avodonosov at yandex.ru Sun Mar 10 19:43:51 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 10 Mar 2013 23:43:51 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation In-Reply-To: <673581362944453@web15e.yandex.ru> References: <5e6efdf62926255017e4bc1f157460a6@hcoop.net> <672541362944334@web15e.yandex.ru> <673581362944453@web15e.yandex.ru> Message-ID: <674891362944631@web15e.yandex.ru> 10.03.2013, 23:41, "Anton Vodonosov" : > Although maybe I know. Is it CLISP and the fresh git version? If yes, try git pull. I've just fixed that. It was a typo I introduced yesterday, sorry for inconvenience. Best regards, - Anton From trivial-gray-streams-devel_common-lisp.net at sumou.com Sun Mar 10 20:23:42 2013 From: trivial-gray-streams-devel_common-lisp.net at sumou.com (=?UTF-8?Q?=E7=99=BD=E3=81=84=E7=86=8A?=) Date: Mon, 11 Mar 2013 00:23:42 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation Message-ID: On Sun, Mar 10, 2013 at 11:43 PM, Anton Vodonosov wrote: > 10.03.2013, 23:41, "Anton Vodonosov" : >> Although maybe I know. Is it CLISP and the fresh git version? > If yes, try git pull. I've just fixed that. Yes, it's CLIPS and git version. Just pulled your update, another error now: WHEN: variable #1=#:GRAY has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE] -- ??? From avodonosov at yandex.ru Sun Mar 10 21:12:58 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Mon, 11 Mar 2013 01:12:58 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation In-Reply-To: <2287701362949924@web12d.yandex.ru> References: <2287701362949924@web12d.yandex.ru> Message-ID: <2411451362949978@web24f.yandex.ru> BTW, why do you use git version? Are you going to perform any development? From avodonosov at yandex.ru Sun Mar 10 21:12:04 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Mon, 11 Mar 2013 01:12:04 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation In-Reply-To: References: Message-ID: <2287701362949924@web12d.yandex.ru> 11.03.2013, 00:23, "???" : > Yes, it's CLIPS and git version. > > Just pulled your update, another error now: > > WHEN: variable #1=#:GRAY has no value > ????[Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE] > Sorry. Fixed that too. Best regards, - Anton From trivial-gray-streams-devel_common-lisp.net at sumou.com Sun Mar 10 22:49:20 2013 From: trivial-gray-streams-devel_common-lisp.net at sumou.com (=?UTF-8?B?55m944GE54aK?=) Date: Mon, 11 Mar 2013 02:49:20 +0400 Subject: [trivial-gray-streams-devel] stream-read-sequence has no value on mixin.lisp compilation Message-ID: <1251a898-0c91-4ad4-b313-c80a82154aa9@email.android.com> On Mar 11, 2013 1:12 AM, "Anton Vodonosov" wrote: > Sorry. Fixed that too. Works now, thanks. On Mar 11, 2013 1:13 AM, "Anton Vodonosov" wrote: > > BTW, why do you use git version? Are you going to perform any development? Just to stay current. -- ??? -------------- next part -------------- An HTML attachment was scrubbed... URL: From avodonosov at yandex.ru Wed Mar 13 11:01:58 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Wed, 13 Mar 2013 15:01:58 +0400 Subject: [trivial-gray-streams-devel] trivial-gray-stream-mixin in cl+ssl In-Reply-To: References: Message-ID: <815761363172518@web27g.yandex.ru> 10.03.2013, 00:10, "James M. Lawrence" : > Hello, I noticed that cl+ssl has the same issue that I recently had > with gray streams. > > (defclass my-stream > ????(trivial-gray-streams:fundamental-binary-input-stream > ?????trivial-gray-streams:fundamental-binary-output-stream > ?????trivial-gray-streams:trivial-gray-stream-mixin) > ??()) > > (defmethod trivial-gray-streams:stream-write-byte > ????((stream my-stream) byte) > ??(format t "~&write-byte ~s~%" byte)) > > (defmethod trivial-gray-streams:stream-write-sequence > ????((stream my-stream) seq start end &key) > ??(format t "~&write-sequence ~s ~s ~s~%" seq start end)) > > (defun test () > ??(write-sequence #(3 4 5) (make-instance 'my-stream))) > > CL-USER> (test) > write-byte 3 > write-byte 4 > write-byte 5 > > The mixin should be the first superclass. With that change, we get > > CL-USER> (test) > write-sequence #(3 4 5) 0 3 > > Best, > James I am fixing that in trivial-gray-streams. First, let me describe the cause of the problem. One thing to know is that tirival-gray-streams classes are just reexported from implementation specific package. For example trivial-gray-streams:fundamental-stream is EQ to sb-gray:fundamental-stream. Next, stream-write-sequence is absent in Gray streams proposal (because write-sequence is absent in CLTL2 I think). Lips implementations provide similar functions, like sb-gray:stream-write-sequence on SBCL, gray:stream-write-char-sequence, gray:stream-write-byte-sequence on CLISP or ccl:stream-write-vector on CCL. Trivial-gray-streams defines a method for the implementation specific write-sequence analogue function, and from this method calls trivial-gray-streams:write-sequence. Besides of the method defined by trivial-gray-streams, the lisp implementation provides a default method. So, there are two methods for implementation specific write-sequence analogue: For example on SBCL: ;; SBCL's default method: (defmethod sb-gray:stream-write-sequence ((stream fundamental-binary-output-stream) (seq sequence) &optional (start 0) (end nil)) ;; trivial gray streams (defmethod sb-gray:stream-write-sequence ((s trivial-gray-stream-mixin) seq &optional start end) The class precedence-list for the my-stream class defined above (on SBCL): COMMON-LISP-USER::MY-STREAM, SB-GRAY:FUNDAMENTAL-BINARY-INPUT-STREAM, SB-GRAY:FUNDAMENTAL-INPUT-STREAM, SB-GRAY:FUNDAMENTAL-BINARY-OUTPUT-STREAM, SB-GRAY:FUNDAMENTAL-OUTPUT-STREAM, SB-GRAY:FUNDAMENTAL-BINARY-STREAM, SB-GRAY:FUNDAMENTAL-STREAM, TRIVIAL-GRAY-STREAMS:TRIVIAL-GRAY-STREAM-MIXIN, COMMON-LISP:STANDARD-OBJECT, SB-PCL::SLOT-OBJECT, COMMON-LISP:STREAM, COMMON-LISP:T As you can see, with this class precedence list the SBCL's default method is choosen (this method calls write-byte repeatedly, as we see in the above test) If we put mixin first in defclass: (defclass my-stream ????(trivial-gray-streams:fundamental-binary-input-stream ?????trivial-gray-streams:fundamental-binary-output-stream ?????trivial-gray-streams:trivial-gray-stream-mixin) ??()) then the class precedence list becomes: COMMON-LISP-USER::MY-STREAM, TRIVIAL-GRAY-STREAMS:TRIVIAL-GRAY-STREAM-MIXIN, SB-GRAY:FUNDAMENTAL-BINARY-INPUT-STREAM, SB-GRAY:FUNDAMENTAL-INPUT-STREAM, SB-GRAY:FUNDAMENTAL-BINARY-OUTPUT-STREAM, SB-GRAY:FUNDAMENTAL-OUTPUT-STREAM, SB-GRAY:FUNDAMENTAL-BINARY-STREAM, SB-GRAY:FUNDAMENTAL-STREAM, COMMON-LISP:STANDARD-OBJECT, SB-PCL::SLOT-OBJECT, COMMON-LISP:STREAM, COMMON-LISP:T With this class precedence list the trivial-gray-streams method is chosen. Summary: in presence of implementation-specific default methods specialized to sb-gray:* classes, and when user inherits his stream from sb-gray:* classes, trivial-gray-streams can not ensure that its method is called, but not the default method. The solution I chosen is that tirival-gray-streams package does not re-export implementation specific gray classes, but defines and exports its own gray class hierarchy. Each class in this hierarchy is also inherited from corresponding implementation specific class. (defclass fundamental-stream (impl-specific-gray:fundamental-stream) ()) (defclass fundamental-input-stream (fundamental-stream impl-specific-gray:fundamental-input-stream) ()) (defclass fundamental-output-stream (fundamental-stream impl-specific-gray:fundamental-output-stream) ()) ... and so on That way any user defined class has trivial-gray-stream class in the precedence list going before the corresponding implementation specific class, and so trivial-gray-streams methods are always chosen by method dispatch. This solution makes trivial-gray-stream-mixin class unnecessary. I have already implemented this in the dev branch of trivial-gray-streams: https://gitorious.org/trivial-gray-streams/trivial-gray-streams/trees/dev Also added test-suite. Results seem to be the same as with old version of trivial-gray-streams. Now I am running cl-test-grid tests of the whole Quicklisp. If there will be no regressions, I will merge the dev branch to master. New trivial-gray-stream test suite is not 100% exhaustive, but it's a beginning. It already shows that all the of the implementations I tested have minor bugs. One ticket is already fixed by SBCL: https://bugs.launchpad.net/sbcl/+bug/1153257 More tickets are to be reported. The most often failure is that no one invokes stream-advance-to-column function when we call (format my-stream "~10,t"). Here is the mapping with failures for various lisps: (("sbcl-1.1.0.45-win-x86" ("stream-clear-output" "stream-advance-to-column")) ("sbcl-1.1.0.36.mswinmt.1201-284e340-win-x64" ("stream-clear-output" "stream-advance-to-column")) ("sbcl-1.1.0.36.mswinmt.1201-284e340-win-x86" ("stream-clear-output" "stream-advance-to-column")) ("abcl-1.1.0-fasl39-win-x64" ("stream-line-column" "stream-advance-to-column")) ("clisp-2.49-win-x86" ("stream-start-line-p" "stream-write-string" "stream-terpri" "stream-fresh-line" "stream-advance-to-column")) ("ccl-1.8-f95-win-x86" ("stream-advance-to-column")) ("ccl-1.8-f95-win-x64" ("stream-advance-to-column")) ("ecl-12.12.1-ab933fa5-win-x86-bytecode" ("stream-advance-to-column" "stream-file-position" "setf-stream-file-position")) ("acl-9.0a-win-x86" ("stream-advance-to-column"))) If you see any problems with my solution, please let me know. Best regards, - Anton From avodonosov at yandex.ru Sat Mar 16 22:48:26 2013 From: avodonosov at yandex.ru (Anton Vodonosov) Date: Sun, 17 Mar 2013 02:48:26 +0400 Subject: [trivial-gray-streams-devel] trivial-gray-stream-mixin in cl+ssl In-Reply-To: <815761363172518@web27g.yandex.ru> References: <815761363172518@web27g.yandex.ru> Message-ID: <1940391363474106@web17g.yandex.ru> cl-test-grid found small problem in my implementation - some libraries (yason for example) do not use trivial-gray-stream-mixin and do not expect trivial-gray-streams:stream-write-sequence to be called at all, so don't define a method for it. Now trivial-gray-streams:stream-write-sequence is always called, so I there must be a default one. After fixing this, no more regressions detected by cl-test-grid (covered ABCL, ACL, CCL, CLISP, CMUCL, ECL, SBCL). The branch dev is merged to master now. Trivial-gray-streams-mixin is deprecated. Best regards, - Anton