Reflection/List properties: Difference between revisions
Content deleted Content added
Added Julia language |
|||
Line 5: | Line 5: | ||
Some languages support dynamic properties, which in general can only be inspected if a class' public API includes a way of listing them. |
Some languages support dynamic properties, which in general can only be inspected if a class' public API includes a way of listing them. |
||
=={{header|Elena}}== |
|||
Using a special property type - dto_prop. |
|||
ELENA 3.3 : |
|||
<lang elena>import system'routines. |
|||
import extensions. |
|||
class MyClass |
|||
{ |
|||
int dto_prop X :: x. |
|||
literal dto_prop Y :: y. |
|||
} |
|||
program = |
|||
[ |
|||
var o := MyClass:: |
|||
{ |
|||
@x := 2. |
|||
@y := "String". |
|||
}. |
|||
o __properties; forEach(:p) |
|||
[ |
|||
console printLine("o.",p,"=",o~p get). |
|||
]. |
|||
].</lang> |
|||
{{out}} |
|||
<pre> |
|||
o.X=2 |
|||
o.Y=String |
|||
</pre> |
|||
=={{header|Fortran}}== |
=={{header|Fortran}}== |