Sujet : Re: UID: Generating pointers in awk
De : cosmogen (at) *nospam* gmail.com (digi_cs)
Groupes : comp.lang.awkDate : 11. Oct 2024, 21:26:45
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <67098add$0$711$14726298@news.sunsite.dk>
Janis: What do you mean by "strong values"?
See documentation: hid
Janis: Do you (maybe) mean "references"? Or really "pointers" as we know them
from C or C++?
I mean true pointers � but not at this level yet.
A pointer � being a short special string � can reference as many arrays and strings as you want:
FIELD[ ptr ] FIELD2[ ptr ] FIELD3[ ptr ] ...
By passing the pointer string, you�re passing an "object" � not a string, not an array, but a collection of them.
Let me give you the simplest example:
For sequential parsing of a string, we need to store the original string somewhere and associate it with the index of the current character from which the next search (match) will take place. The question is: how do you link two independent values? Through a pointer:
Let�s assume the original string is stored in _MAC[ ptr ] and the index of the current character in the string is stored in _MACSP[ ptr ]. By passing ptr, you�re passing both of these values. Now imagine how many different fields an object can have � and all of this is passed by a short pointer string.
A pointer can be assigned to a variable and returned as a function result. Pointers can be combined and passed together as a list.
To understand this better, check the library�s code � how the UID generators are implemented is an excellent example of how to work with pointers.
Janis
A quick general comment...
Awk is a HLL, abstracting from low-level constructs. It's beyond me
why you think that pointers would be necessary or even "key for the
further development of programming in awk as a whole".
I might say more if I'll have read the documentation.
??? ?????? ??, ? ??? ? ? ?????? � ?????? ??????? ???????????. ?????? ?? ????? ??????????? �?????????� ? ?? ?????? ???????? ??? ?????????
Janis:
BTW; I would have appreciated it if you'd have provided some minimum
more concrete information here in this newsgroup about the features,
rationale, and similar useful information, before directing us to
external Web-links to github trees.
The difficulty lies in the fact that the unique strings generated by this library are not fully-fledged pointers. Such pointers only appear with the class-based implementation, which I also plan to release. Yes, you can use the strings generated by the default UID generator as pointers, but they are merely abstract strings � which, for example, can be placed directly into the original data if, say, it�s text.
Therefore, the description of basic pointer manipulation techniques is a task for the future class-based implementation. This library only provides the bodies of the pointers. Nevertheless, they CAN be used effectively in awk.
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from
https://www.shemes.com/ =-