From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116312 invoked by alias); 21 Nov 2017 22:49:08 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 116300 invoked by uid 89); 21 Nov 2017 22:49:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*kawa, kawa, Hx-languages-length:1407, Prompt X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Nov 2017 22:49:06 +0000 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1eHHLi-0002os-KU; Tue, 21 Nov 2017 23:49:02 +0100 Received: from 32.109.34.95.customer.cdi.no ([95.34.109.32] helo=localhost.localdomain) by mailfront11.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1eHHLa-0001Ko-OF; Tue, 21 Nov 2017 23:48:54 +0100 Subject: Re: Prompt on read To: Helmut Eller , kawa@sourceware.org References: From: Per Bothner Message-ID: Date: Tue, 21 Nov 2017 22:49:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q4/txt/msg00033.txt.bz2 On 11/21/2017 04:44 PM, Helmut Eller wrote: > Am I the only who finds it confusing that the read procedure > automatically writes a prompt? E.g. > > #|kawa:1|# (read) > #|kawa:2|# abc > abc > #|kawa:2|# The read procedure does not write a prompt. However, when you read from an "interactive port" (implemented using TtyInPort, when a new line is requested, a prompt is printed. In other words, in Kawa it's not the REPL that prints the prompt, but the port itself. This has the advantage that multi-line input commands get multiple =prompts, which I think is the correct behavior. > Despite that the prompt in line two is confusing, the line number in the > third prompt seems wrong. I would expect that read works basically like > read-line, Yes and no. read reads an S-expression, and there may be a many-to-many relationship between S-expressions and lines. A prompt is printed before each input line - however note it is possible for a procedure to change the prompt, for example to the empty string. I agree there does appear to be some mismatch between when a line number is incremented and a prompt is printed. This is at least ugly. I haven't looked into why that happens. FWIW I can't come up with any valid use-case for explicitly calling read on an interactive port. The problem is error recovery. Enlighten me. -- --Per Bothner per@bothner.com http://per.bothner.com/