Path: utzoo!attcan!uunet!shakti!shri From: shri@ncst.ernet.in (H.Shrikumar) Newsgroups: comp.lang.forth Subject: Re: Data Structures Summary: Pointer In Pointer Out ... Message-ID: <978@shakti.ncst.ernet.in> Date: 2 Oct 90 11:31:53 GMT References: <9009220053.AA13718@ucbvax.Berkeley.EDU> Reply-To: shri@ncst.in (H.Shrikumar ) Organization: National Centre for Software Technology, Bombay, INDIA Lines: 36 In article <9009220053.AA13718@ucbvax.Berkeley.EDU> wmb%MITCH.ENG.SUN.COM@SCFVM.GSFC.NASA.GOV replies to ... >> How do I get "adr len" on the stack? The operation is defined for strings >> defined with " , but what about strings in memory? I can only get the > >The operators for manipulating strings should be as general as possible, >and independent of how those strings happen to be encoded when stored >in memory. Yup. Also could overload the same ideogram for same action on strings of differnt types, the correct word being selected by the value of a variable called TYPE, (much as numbers are interpretted according to current value of BASE). (* I saw a feature with similar intensions first in Mikael Patels xforth.) Also, another thing I am trying out in myForth is that all operators which take a pointer, should return a pointer. The idea is ... say a word that takes a string and replaces "$1" by "gus" ("fun$1prat" becomes "fungusprat") would take a pointer to the string, do its job and return a pointer to the new string. The retuned pointer may or may not be the same, the program must not make assumptions about it (sorry hackers :-). This is not too difficult to implement, only a little inefficient, and gives a clean semantics. (IMHO, worth it.) For eg. the string could be in ROM, and when somebody tried to modify it, the word could (if so designed) copy it into RAM "transparently", change it and return a new pointer. This could also become the basis for several other features (memory de-fragmentation etc.) -- shrikumar ( shri@ncst.in )