fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: ?

? <output> 7 months 10 hours ago #1

  • Karl-Heinz
  • Karl-Heinz's Avatar Topic Author
  • Offline
  • Posts: 196
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

Please Log in or Create an account to join the conversation.

? <output> 7 months 9 hours ago #2

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
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

? <output> 7 months 2 hours ago #3

  • Karl-Heinz
  • Karl-Heinz's Avatar Topic Author
  • Offline
  • Posts: 196
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.

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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1