bugKawa - Bugs: bug #36992, Values printing error

 
 

bug #36992: Values printing error

Submitted by:  Charles Turner <charlest>
Submitted on:  Sun 29 Jul 2012 06:27:19 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Unexpected resultStatus: None
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 17 Aug 2012 02:13:14 AM UTC, comment #3:

I figure printing:
(values X Y)
should print the same as printing X followed by printing Y.
Similarly evaluating on the command line (or in an eval):
X Y
first evaluates and print X, then evaluates and prints Y.
I figure this should be equivalent to evaluating (values X Y).

I.e.
(display (values X y))
should be the same as:
(display X) (display Y)
and of course
(display "per") (display "bothner")
should print
perbothner
without a small.

I.e. when printing string or chars, we assume any extra spaces are explicit. However, when printing numbers it doesn't really make sense to just concatenate them, so we add a space.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 02 Aug 2012 10:50:05 AM UTC, comment #2:

Just as it would make no sense for (values 1 2) to print 12, it doesn't (IMHO) make a lot of sense for (values "per" "bothner") to print perbothner.

Wouldn't the programmer have intended to return them (and hence have them printed) distinctly if they chose VALUES?

Could you elaborate on this a little bit? Still confused.

Thanks!
Charles.

Charles Turner <charlest>
Thu 02 Aug 2012 06:00:01 AM UTC, comment #1:

The behavior is as intended.
The idea is that strings (and chars and charsequences) are printed as is. However, numbers and other "atoms" are printed with a space separator, since it doesn't make semantic sense to "concatenate" the printed representation of (say) numbers.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 29 Jul 2012 06:27:19 PM UTC, original submission:

Here's the current behaviour

#|kawa:1|# (values "ka" "wa")
kawa
#|kawa:2|# (values 1 "wa")
1wa
#|kawa:3|# (values "ka" 1)
ka1
#|kawa:4|# (values 1 2)
1 2

The first three lines are very confusing with less obvious code. The following "fix" sorts out this small example, but it's certainly incorrect

Index: gnu/kawa/functions/DisplayFormat.java
===================================================================
--- gnu/kawa/functions/DisplayFormat.java (revision 7281)
+++ gnu/kawa/functions/DisplayFormat.java (working copy)
@@ -186,7 +186,7 @@
if (out instanceof OutPort
&& ! (obj instanceof gnu.kawa.xml.UntypedAtomic)
&& ! (obj instanceof Values)
- && (getReadableOutput()
+ && (getReadableOutput() || obj instanceof String
|| ! (obj instanceof Char
/* #ifdef use:java.lang.CharSequence */
|| obj instanceof CharSequence

Can assign it to me for now if you like, seems like it's going to require reacquainting myself with how the printer works.

Charles.

Charles Turner <charlest>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by charlest (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 02 Aug 2012 06:00:01 AM UTCbothnerAssigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup