How to find the type of a variable in the Chapel

I seem to have stumbled upon an answer and then lose. I'm on the "losing" scene. If I have an object in Chapel, which is equivalent

Python
>>> thing = 'i am a thing'
>>> type(thing)
<type 'str'>

I saw that writeln(A.type)and writeln(type(A))the two throw form errors

'writeln(type _array(DefaultSparseArr(real(64),2,int(64),DefaultSparseDom(2,int(64),_domain(DefaultRectangularDom(2,int(64),false))))))'
$CHPL_HOME/modules/standard/IO.chpl:3992: note: candidates are: channel.writeln(out error: syserr) [233811]
$CHPL_HOME/modules/standard/IO.chpl:3998: note:                 channel.writeln() [233840]
$CHPL_HOME/modules/standard/IO.chpl:4006: note:                 channel.writeln(const args ...?k, out error: syserr) [233876]
$CHPL_HOME/modules/standard/IO.chpl:4012: note:                 channel.writeln(const args ...?k) [233916]
$CHPL_HOME/modules/standard/IO.chpl:4020: note:                 channel.writeln(const args ...?k, style: iostyle) [233954]
$CHPL_HOME/modules/standard/IO.chpl:4047: note:                 channel.writeln(const args ...?k, style: iostyle, out error: syserr) [233998]
$CHPL_HOME/modules/standard/IO.chpl:4267: note:                 writeln(const args ...?n) [235140]
$CHPL_HOME/modules/standard/IO.chpl:4273: note:                 writeln() [235158]
+4
source share
1 answer
var x = 1;
writeln(x.type:string);
+5
source

Source: https://habr.com/ru/post/1686225/


All Articles