Allow .Class's SUBCLASS and MIXINCLASS methods to also add class methods
Dynamically created plain class has no NEW class method
I wrote a locking class. I implemented two types of locking: via a semaphore and via a channel. Channel locking allows you to determine which process has acquired the lock and avoid a situation where a process locks itself. To test semaphore locking, run the code as is several times. Until the first running instances close, subsequent instances will be unable to acquire the lock. Interestingly, even if you close windows incorrectly by killing the process, the lock is still released. To test channel...
Update: I ran the code on Linux and it does supports microseconds, so ooRexx's time function is O/S dependent and not normalized across all O/S(s). CLOCK=991 (milliseconds) TIME(F)=991313 (microseconds) TIME(E)=0.991291 (seconds) CLOCK=991 (milliseconds) TIME(F)=991342 (microseconds) TIME(E)=0.991321 (seconds) CLOCK=991 (milliseconds) TIME(F)=991371 (microseconds) TIME(E)=0.991350 (seconds) CLOCK=991 (milliseconds) TIME(F)=991400 (microseconds) TIME(E)=0.991379 (seconds) CLOCK=991 (milliseconds)...
Update: I ran the code on Linux and it does supports microseconds, so ooRexx's time function is O/S dependent and not normalized across all O/S(s).
The clock's resolution is based on the underlying operating system's clock API. For Windows this is 1ms. However, ooRexx normalizes all clock values to milliseconds, effectively discarding any finer-grained precision that might be available. The following code demonstrates this using TIME(F) and TIME(E) NUMERIC DIGITS 18 Say "Demostrates ooRexx's clock precision" Say " " Say "Press ENTER to start demostration" startTime = Time('F') -- Number of microseconds since Jan 1, 0001 elapseTime = Time('E')...
Thank you, Jon!
Patch doc_bug_325.7.1 applied.
325_7.1 patch provided by Josep Maria Improving documentation of namespaces
Hi again, Thus if one wants to override an superclass INIT, one must define a class NEW method, is that what you are saying? That is not true for (I think all) other collections with an optional SIZE argument? Seems to me that the way a multidimensional Array can be defined causes the problem and it could be solved by allowing arguments after a not defined first argument (which would create a 1 dimensional array) and pass them on to the subclass INIT. HTH (a little joke here) Ruurd P.S. For multidimension...
I need to monitor the time elapsed since the start of an operation. For testing, I implemented the following code: WaitingTime = 1*1000000 NUMERIC DIGITS 18 SemTimestamp=time('f') say 'time(e)='time('e') do forever if WaitingTime>0 then if (time('f')-SemTimestamp)>WaitingTime then do say '---'time('f')'-'SemTimestamp'='time('f')-SemTimestamp'>'WaitingTime say 'time(r)='time('r') say '<!> WaitingTime ERROR'; return end -- if if say '==='time('f')'-'SemTimestamp'='time('f')-SemTimestamp'>'WaitingTime...
I need to monitor the time elapsed since the start of an operation. For testing, I implemented the following code: WaitingTime = 1*1000000 NUMERIC DIGITS 18 SemTimestamp=time('f') say 'time(e)='time('e') do forever if WaitingTime>0 then if (time('f')-SemTimestamp)>WaitingTime then do say '---'time('f')'-'SemTimestamp'='time('f')-SemTimestamp'>'WaitingTime say 'time(r)='time('r') say '<!> WaitingTime ERROR'; return end -- if if say '==='time('f')'-'SemTimestamp'='time('f')-SemTimestamp'>'WaitingTime...
Hi again, Thus if one wants to override an superclass INIT, one must define a class NEW method, is that what you are saying? That is not true for (I think all) other collections with an optional SIZE argument? Seems to me that the way a multidimensional Array can be defined causes the problem and it could be solved by allowing arguments after a not defined first argument (which would create a 1 dimensional array) and pass them on to the subclass INIT. HTH (a little joke here) Ruurd On 11/5/25 11:58,...
Hi Ruurd, ad "rexxref: 4.2.5 Default search order for methods": this is why it works, if you define a class method NEW for your subclass. It will be picked up before the superclass's NEW method. ad "rexxref: 4.2.9. Initialization": this is currently discussed on the developer list. HTH ---rony
Hi Rony, So how does what you say about NEW agree with: rexxref: 4.2.5 Default search order for methods This search order places methods of a class before methods of its superclasses so that a class can supplement or override inherited methods. and rexxref: 4.2.9. Initialization Any object requiring initialization at creation time must define an INIT method. If this method is defined, the class object runs the INIT method after the object is created. If an object has more than one INIT method (for...
NEW class methods in Object and Class not correct
You could try the following: create a proper class and create the semaphore in its INIT method, and the canceleation of the semaphore in a method named UNINIT. Usually, if an object is not referenced anymore the garbage collector will destroy it and right before destruction the "dead" object gets the UNINIT message sent, such that the object will invoke the UNINIT method to run your code there.
Hi Ruurd, if you study the Array class in the reference you will see that it defines its own NEW class method. Therefore you need to study it to see what it does. As you will see Array's NEW method does not send an INIT message to a newly created Array object. This is different than the behaviour of Object's NEW class method which will send the newly created object the INIT message with the received arguments in the same order, if any. If you want to take care of creating Array objects in a different...
Can we expand on this? I have a program that created a semaphore and exited without deleting it. It exited, perhaps by mistake. The semaphore remains in the system, and the next time the program is launched, it goes into an infinite wait. Are there algorithms and methods for combating this? For example, so that when the process owning the semaphore closes, the semaphore is closed automatically.
Thank you, P.O.!
Collection classes erratically documented as MapCollections
Collection classes erratically documented as MapCollections
Applied the patch without problems
commiting doc_bug_352.diff
Testing to commit via TortoiseSVN
Here's a small additional patch for the "namescape-prefixed" mention.
Interesting. There are six occurrences of "namespace-" in rexxref. Five are "namespace-qualified", and one is "namespace-prefixed". Clearly, this should be fixed to "namespace-qualified". Thanks for pointing this out.
found this in ressref: namespace-prefixed symbol.
Here's an updated patch, following Gil's suggestion.
Sounds much better, yes. Thanks, Gil!
Perhaps "namespace-qualified symbol" assuming that is defined in the section on Namespaces? Just a thought.
"namespaced symbol" = "a symbol preceded by a namespace and a colon".
WHAT is a namespaced symbol. rexxref talks about namespace but not namespaced
Looks good, thank you very much, Josep Maria!
Looks good, thank you very much, Josep Maria!
Looks good, thank you very much, Josep Maria!
Here's a patch.
Here's a patch.
Here's a patch.
Collection classes erratically documented as MapCollections
Sorry for bothering you, I found it myself. The line should look like this. FileAray['!OLDITEMS']=OLDItems say FileAray['!OLDITEMS']['A']
Sorry for bothering you, I found it myself. The line should look like this. say FileAray['!OLDITEMS']['A']
Good day! I have a stem and need to add the contents of another stem to it. Can you tell me how to do this without a loop? An example, a vision of "how it should be." Of course, it doesn't work. OLDItems=.stem~new OLDItems['A']=1 OLDItems['S']=2 OLDItems['D']=3 OLDItems['F']=4 FileAray=.stem~new FileAray['!FILENAME']=FileActual FileAray['!OLDITEMS.']=OLDItems. say FileAray['!OLDITEMS.A'] I'd like to see "1" as the output.
Namespaces in directives
Ok, thanks for your investigation, I'll wait and see. Ruurd On 10/31/25 10:06, jfaucher wrote: So I still think it should be fixed or the docs should be made more specific. I agree but I can't tell what is the preference of the ooRexx team. In the meantime, this code will work: |::classtypedArraypublicsubclassArray ::attributetype ::methodnewclass say"Method 'new'' for typedArray instance" usestrictargtype if"RTW"~pos(type[1]~upper)==0 thenraisesyntax93.914array(1,"R(ony),T(im),W(ill)",type) / superclass...
So I still think it should be fixed or the docs should be made more specific. I agree but I can't tell what is the preference of the ooRexx team. In the meantime, this code will work: ::class typedArray public subclass Array ::attribute type ::method new class say "Method 'new'' for typedArray instance" use strict arg type if "RTW"~pos(type[1]~upper)==0 then raise syntax 93.914 array(1,"R(ony),T(im),W(ill)",type) /* superclass 'new' called with proper argument */ self~new:super(1) myArray = result...
Well, the code shows that INIT is not called at all for the subclass instance. The subclass is responsible for calling the INIT for the superclass if necessary, via an INIT:SUPER call or via the FORWARD keyword . So I still think it should be fixed or the docs should be made more specific.
I started a code review (attached file), which I stopped after you found a workaround. You will see that the Array class doesn't forward the 'new' arguments to 'init'. Several native classes respect what's written in rexxref.pdf 5.1.1.20. new: "If you specify args, new passes these arguments on the init message." Other classes don't, maybe for good reasons, but I can't tell. Update: Several classes (like 'List') don't check/use the arguments in the 'new' method. It's done in the init method: * The...
I started a code review (attached file), which I stopped after you found a workaround. You will see that the Array class doesn't forward the 'new' arguments to 'init'. Several native classes respect what's written in rexxref.pdf 5.1.1.20. new: "If you specify args, new passes these arguments on the init message." Other classes don't, maybe for good reasons, but I can't tell.
One more try to convince the behaviour is a (in my opinion serious) bug: #!/usr/bin/env rexx list = .myList~new("Mike") array = .myArray~new('Rick') ::class myList public subclass List ::method init say arg(1,A) self~init:super(10) ::class myArray public subclass Array ::method init say arg(1,A) self~init:super(10) If you run this code , you will notice that the init for myArray is not called at all, while it is the first class in the in the order of classes and it is not allowed to call the superclass...