xsharp.eu • ? <output>
Page 1 of 1

? <output>

Posted: Sun Aug 26, 2018 10:10 am
by Karl-Heinz
Hi Robert,

This works the same way as it does with VO

? <xExp1> , <xExp2> , <...>

Some time ago i´ve noticed that with X# this is also possible:

? <xExp1> + " " + <xExp2> + " " + <...>

My question: is the second way restricted ? I´m asking because i´ve noticed that there are several problems when VO specific types are involved.

regards
Karl-Heinz

? <output>

Posted: Sun Aug 26, 2018 12:00 pm
by robert
Karl Heinz,
The second method uses the built-in mechanism of .Net that every type has a ToString() method. I am not sure which problem you are seeing. Maybe one of the built-in types needs a better ToString() ?

Robert

? <output>

Posted: Sun Aug 26, 2018 6:33 pm
by Karl-Heinz
Hi Robert,

yes, something like

? eval ( cb , 5 ):Tostring()
? fValue:Tostring()

does not cause any problems, but the code below throws several runtime errors when VO specific types are involved.

Code: Select all


FUNCTION DoOutPut() AS VOID 

  LOCAL fValue AS FLOAT
  LOCAL a AS ARRAY
  LOCAL cb AS CODEBLOCK 
  LOCAL u AS USUAL



   fValue := 12.23

   cb := {| n | n + 1  }

   a := { "one" , "two" }

   u := 12333

   

   //  If the very first expression result is a VO type:

   //  "incompatible argument" runtime error 
       
	
    ?  today()  + "  " + setcentury()     //  <-----


    //  "out of range" runtime error  

    ?  a [ 1 ] + " " + setcentury()   //  <-----


    //  ------------

    // If the very first result is not a VO specific type it runs. 

     ? SetCentury()  + " " + today() 


     ? setcentury() + " " + a [ 1 ] 


     ?  _chr(9) + today()       
  
     ? space(20) + today()  

 
   // But floats, usuals and codeblocks throw runtime errors,
   // no matter if they are positioned at second pos.
       
      // "argument is not numeric"
     ? setcentury()  + " " + fValue     //  <----- 
       
      //  "out of range" 
     ? setcentury() + "  " + eval ( cb , 5 )   //  <-----	
	 
      //  "out of range" 
	     
       ? setcentury() + " " + u   //  <-----	
	 
       ?
	 
	
	
	RETURN


regards
Karl-Heinz