Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
From: Christian Kellermann ck...@pestilenz.org Subject: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures. Date: Sun, 25 Sep 2011 19:45:23 +0200 The attached patch should be a little bit faster than the old version since we don't do redundant type checks and call the ports write-string method directly. Thanks to felix for the suggestion. Thanks for taking care of this issue, Christian! Two more suggestions: - use ##sys#check-port* to make sure the port is open - use ##sys#check-port-mode to do the direction check cheers, felix ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
* felix winkelmann fe...@call-with-current-continuation.org [110926 08:45]: From: Christian Kellermann ck...@pestilenz.org Subject: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures. Date: Sun, 25 Sep 2011 19:45:23 +0200 The attached patch should be a little bit faster than the old version since we don't do redundant type checks and call the ports write-string method directly. Thanks to felix for the suggestion. Thanks for taking care of this issue, Christian! Two more suggestions: - use ##sys#check-port* to make sure the port is open - use ##sys#check-port-mode to do the direction check Ah, those are convenient. I have attached an updated version of the patch. Thanks! Christian -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. From ca7811daf4951c93dcd60cc559197602dcb27f66 Mon Sep 17 00:00:00 2001 From: Christian Kellermann ck...@pestilenz.org Date: Sun, 25 Sep 2011 11:58:02 +0200 Subject: [PATCH] replace write-line calls to display with internal procedures. --- extras.scm | 15 +-- 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/extras.scm b/extras.scm index bb9e434..e2bcf76 100644 --- a/extras.scm +++ b/extras.scm @@ -134,13 +134,16 @@ (define write-line (lambda (str . port) -(let ((p (if (##core#inline C_eqp port '()) -##sys#standard-output -(##sys#slot port 0) ) ) ) - (##sys#check-port p 'write-line) +(let* ((p (if (##core#inline C_eqp port '()) + ##sys#standard-output + (##sys#slot port 0) ) ) + (write-string (and + (##sys#check-port* p 'write-line) + (##sys#check-port-mode p #f 'write-line) + (##sys#slot (##sys#slot p 2) 3 (##sys#check-string str 'write-line) - (display str p) - (newline p) ) ) ) + (write-string p str) + (##sys#write-char-0 #\newline p ;;; Extended I/O -- 1.7.4.1 ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
* Christian Kellermann ck...@pestilenz.org [110926 10:01]: Ignore this. I suck. Let me fetch some coffee and redo it properly. That should work better. -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. From 2c7581199b05019f4418cd31ec147a3d8cc2a4e1 Mon Sep 17 00:00:00 2001 From: Christian Kellermann ck...@pestilenz.org Date: Sun, 25 Sep 2011 11:58:02 +0200 Subject: [PATCH] replace write-line calls to display with internal procedures. --- extras.scm | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extras.scm b/extras.scm index bb9e434..3be95cc 100644 --- a/extras.scm +++ b/extras.scm @@ -134,13 +134,14 @@ (define write-line (lambda (str . port) -(let ((p (if (##core#inline C_eqp port '()) -##sys#standard-output -(##sys#slot port 0) ) ) ) - (##sys#check-port p 'write-line) +(let* ((p (if (##core#inline C_eqp port '()) + ##sys#standard-output + (##sys#slot port 0) ) )) + (##sys#check-port* p 'write-line) + (##sys#check-port-mode p #f 'write-line) (##sys#check-string str 'write-line) - (display str p) - (newline p) ) ) ) + ((##sys#slot (##sys#slot p 2) 3) p str) ; write-string method + (##sys#write-char-0 #\newline p ;;; Extended I/O -- 1.7.4.1 ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] Ports checking
I've noticed that at least in extras.scm almost none of the procedures check whether they get the *right* port, i.e. whether read routines get input-port and write procedures get output-ports. True. These ought to get extended. There are also more things that should be done: ##sys#check-port-mode could implicitly check for the argument being a port. ##sys#check-port* doesn't pass the location to ##sys#check-port. And ##sys#check-port + ##sys#check-port* should be rewritten to cheaper forms to avoid a CPS call ... Phew. So much to do. The obvious thing would be to add type checks to each but maybe that could also be done by the scrutinizer? Is it (by design) possible to extend it that way to add some tags to a port identifier? For library code it might be better to add those checks manually. Joerg already suggested type-check generation, but I haven't had the time to investigate this. So much to do. At the moment there is no extra type tag for ports is there? port is the type-specifier for ports. The more I think about it the more I like the idea to let this work be done by the scrutinizer. If the check fails most of the procedures will fail with a 'Error: call of non-procedure: #f' as they do now. Yes, that sucks. cheers, felix ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] [PATCH] simplify typevar instantiation handling in scrutinizer
* felix winkelmann fe...@call-with-current-continuation.org [110926 13:28]: From: Felix fe...@call-with-current-continuation.org Subject: [PATCH] simplify typevar instantiation handling in scrutinizer Date: Mon, 26 Sep 2011 09:23:02 +0200 (CEST) Attached is a patch that simplifies the use of over-all-instantiations in the scrutinizer. Peter was of course right about the redundant matching at some call-sites of this procedure, which I boneheadedly refused to see. This patch also fixes a bug in the transformation of the internal node tree to s-expressions for the ##core#typecase construct. Testcases have been added. The changes have been tested with the core test-suite and all core libraries and tools. Please ignore the previous patch. This new one contains an additional fix in type=? (subtype checking). I cannot say I understand fully what you are doing here. But I could not find an obvious blunder in it. But then I would have said the same about the previous version I guess :) It did not break anything on my system so far, so I say: OK. Kind regards, Christian P.S.: Hopefully I will understand this stuff better soon or this will blow up in my face sooner or later. -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers