From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: problem with trailing comment in repl Date: Sun, 13 Feb 2011 10:22:24 -0500 Message-ID: References: <87r5beb7dg.fsf@gnu.org> <8739ntbd8a.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1297610556 18651 80.91.229.12 (13 Feb 2011 15:22:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Feb 2011 15:22:36 +0000 (UTC) Cc: "Jose A. Ortega Ruiz" , guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Feb 13 16:22:31 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PodmQ-0007CA-3P for guile-devel@m.gmane.org; Sun, 13 Feb 2011 16:22:30 +0100 Original-Received: from localhost ([127.0.0.1]:49634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PodmP-000893-Ku for guile-devel@m.gmane.org; Sun, 13 Feb 2011 10:22:29 -0500 Original-Received: from [140.186.70.92] (port=34507 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PodmM-00088o-R0 for guile-devel@gnu.org; Sun, 13 Feb 2011 10:22:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PodmL-00051z-Cl for guile-devel@gnu.org; Sun, 13 Feb 2011 10:22:26 -0500 Original-Received: from mail-gw0-f41.google.com ([74.125.83.41]:50707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PodmL-00051r-8P; Sun, 13 Feb 2011 10:22:25 -0500 Original-Received: by gwj22 with SMTP id 22so1932673gwj.0 for ; Sun, 13 Feb 2011 07:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=a8Ru9ve7/ZSVoOPjjWuYf8NrreWFBlxeM5UG+75cVhU=; b=hc8HGqFrwKo61R0KdaNozOU9n1m9v0wjz7guK9LwO5q1c+iMa8vxCpfkphNYRdSDM4 vUwl1YhMQjvwKLSocTi4fLucfIQOZ4G3sNYt2CMlVqf50OiPQqBGmmemzBZhwQ4vPhlZ VI6KXR6RP5wTI0xlizJZaj0ZOBN7kbpbL4lvA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Pe3DdTCLpDJY5akE3VysjJq3k4ZRz7IqXK0Mz0XbwU28DJYwKfM1dMhIjfWjl8EQ5x 5VzJ5tEuHkguowW3NGyh33SPc7S0AkYhEwhNNNhEltR2sRwLi2EfiAlD0m2i3D2fZxwh S53EuRfk2/EQrKADIXz3xS6YMJguXVx91ODhE= Original-Received: by 10.150.11.16 with SMTP id 16mr3080307ybk.444.1297610544496; Sun, 13 Feb 2011 07:22:24 -0800 (PST) Original-Received: by 10.147.40.5 with HTTP; Sun, 13 Feb 2011 07:22:24 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: GxfHWLUdAGN8IDDwMFs79WiL0EY X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11599 Archived-At: Hello all, I was thinking about how this might be solved. I can see two ways of doing = it: - The nicer way: add a new read function (or a keyword argument to the current read function) that can tell it to stop without returning anything if it hits a newline and there's no more input ready on its port. You'd probably have to have it return a special "no expression" token, but you could make that with an uninterned symbol. - The quicker way: if the language in use is scheme, change the next-char function (repl.scm line 205) to know about comments, so that if it saw a semicolon, it would snarf everything until the end of the line. Either way is language-specific, but I don't think that's really avoidable since different languages have different comment syntaxes. Either way could also lead to a situation where some languages (i.e. Scheme) had the nice prompt-printing functionality and others didn't, but again, I think that's to be expected if this has to be implemented once per language. What do you all think of these ideas? Noah On Sat, Feb 12, 2011 at 9:36 AM, Andy Wingo wrote: > On Sat 12 Feb 2011 14:21, "Jose A. Ortega Ruiz" writes: > >> I'm not sure i understand this reasoning, because when there are two (or >> more) complete sexps in a line they're accepted, and a new prompt >> appears; > > Of course. > > =A01. Guile: No input available, print prompt: > =A0 =A0 guile> > > =A02. User: one line of input: > =A0 =A0 (exp-1) (exp-2) > > =A03. Guile: read one sexp > > =A04. Guile: flush whitespace; input state is: > =A0 =A0 (exp-2) > > =A05. Guile: Input is ready, so don't print prompt, just read > > =A06. Guile: Flush whitespace, no input available, so print prompt: > =A0 =A0 guile > >> i was expecting a comment to be equivalent to whitespace. > > We could add some hacks in that regard, but it wouldn't work for > ecmascript... =A0If there is input, Guile calls `read', not some > hypothetical `read-syntax' that could return a comment, and `read' > doesn't return until it has read an entire expression. > >> However, i think there's a problem with metacommands at the >> "non-prompt": >> >> =A0 =A0 scheme@(guile-user)> ;; foo >> =A0 =A0 ,error >> =A0 =A0 While compiling expression: >> =A0 =A0 Syntax error: > > Meta-commands have to be the first thing on the prompt. =A0It's a special > case to look for the comma character; once we've seen non-whitespace -- > ";" in this case -- we're in the scheme reader, not the repl reader. > > Regards, > > Andy > -- > http://wingolog.org/ > >