|
On Oct 30, 2013, at 9:28 AM, whatt sson <whattssonn@xxxxxxxxx> wrote:
A better thing to wish for is built-in suppport for maps/dictionaries (e.g.
the "Map" class in Java).
Add/remove/sort keys and values in a map, easily.
Then you would also have "reflection", or simply you can query the keys,
etc.
Btw, a map's value could be another map.
Data structures are - be definition - static structures layed out in memory
without any meta data (like the names of the fields etc).
This is by design, it makes them efficient.
What you really want is support for MAPS.
On Wed, Oct 30, 2013 at 3:21 PM, Charles MARTIN <cmartin@xxxxxxxxxxxxxxx>wrote:
Hello everyone,--
I wish i could do some reflection using RPGLe.
By reflection, I mean :
'The process or mechanism of determining the capabilities of an object at
run-time.'
Imagine you have this datastructure :
D DS_Format DS Qualified Based(pDS_Format)
D Type 20I 0 Inz(1)
D Label 50A Inz('myLabel')
D Description 5000A Inz('myDescription')
With a reflection api, I could do this :
Reflection_ListSubfields(DS_Format);
=> return this array : { 'Type', 'Label', 'Description' }
And then, I could do :
Reflection_GetSubfield(DS_Format : 'Label');
=> return 'myLabel'
I wish i could do this too :
Reflection_GetSubfieldType(DS_Format : 'Label');
=> return 'A'
Reflection_GetSubfieldLength(DS_Format : 'Label');
=> return 50
Reflection_GetSubfieldPrecision(DS_Format : 'Type');
=> return 0
With this, I expect I could do something like this (with some little work)
:
SerializeXml(DS_Format); //I build xml with one line of code !
And get :
<DS_Format>
<Type>1</Type>
<Label>myLabel</Label>
<Description>myDescription</Description>
</DS_Format>
And conversely with DeserializeXml(myXml);
Reflection would help me to build really cool apis.
Is there any way ?
Charles
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.