## IDL 8.4: Variable attributes and static methods

posted Tue 25 Nov 2014 by Michael Galloy under IDL, ObjectsThe biggest change introduced by IDL 8.4 is the treatment of all variables as objects. Every variable now has attributes that you would normally get returned from the `SIZE`

function: `length`

, `ndim`

, `dim`

, `tname`

, `typecode`

, and `typename`

. For example:

```
IDL> a = bindgen(2, 3)
IDL> print, a.length
6
IDL> print, a.ndim
2
IDL> print, a.dim
2 3
IDL> print, a.tname
BYTE
```

There are also static methods available for all variables:

```
IDL> n = 50
IDL> print, n->toString()
50
```

Strings, numbers, integers, and pointers have their own set of special methods appropriate for their respective types. For example integers have some handle base conversion methods:

```
IDL> print, n->toHex()
32
IDL> print, n->toBinary()
110010
```

Strings have some methods that are not available through other IDL library routines, including the very useful `replace`

method:

```
IDL> s = 'ITT VIS'
IDL> print, s.replace('ITT', 'Exelis')
Exelis VIS
```

http://www.exelisvis.com/Company/PressRoom/Blogs/IDLDataPointDetail/TabId/902/ArtMID/2926/ArticleID/14135/IDL-84—Sliced-bread-step-aside.aspx