bugKawa - Bugs: bug #36992, Values printing error

 
 

bug #36992: Values printing error

Submitter:  Charles Turner <charlest>
Submitted:  Sun 29 Jul 2012 06:27:19 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Unexpected result Status:  Wont Fix
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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>
Group administrator
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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-04-08 bothner StatusNone Wont Fix
        Open/ClosedOpen Closed
    2012-08-02 bothner Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code