On 07.03.2023 08:45, David Crayford wrote:
On 7/3/23 02:39, Rony G. Flatscher wrote:
On 06.03.2023 02:43, David Crayford wrote:
... cut ...
I did notice that CMake is being used for the build. That's good as IBM have ported CMake to z/OS.
It's hidden away on a personal Github repo by an ex-IBMer who used to work in the Java JIT team. I
may mention that to IBM.
Anyway, I digress. ooRexx still have the same portability issues as before. For example, it
assumes that 'phread_t' is a integer. On z/OS, System i, BSD etc it's an opaque type, a struct.
In file included from
/u/ts8004/git/ooRexx/common/platform/unix/SysSemaphore.hpp:51:
/u/ts8004/git/ooRexx/common/platform/unix/SysThread.hpp:70:36: error: no matching constructor for
initialization of 'pthread_t'
SysThread() : attached(false), _threadID(0) { ; }
^ ~
/usr/include/sys/types.h:300:19: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'int' to 'const pthread_t' for 1st argument
typedef struct {
^
/usr/include/sys/types.h:300:19: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'int' to 'pthread_t' for 1st argument
/usr/include/sys/types.h:300:19: note: candidate constructor (the implicit default constructor)
not viable: requires 0 arguments, but 1 was provided
In file included from /u/ts8004/git/ooRexx/rexxapi/client/ClientMessage.cpp:41:
In file included from
/u/ts8004/git/ooRexx/rexxapi/client/LocalAPIManager.hpp:47:
In file included from
/u/ts8004/git/ooRexx/common/platform/unix/SysSemaphore.hpp:51:
/u/ts8004/git/ooRexx/common/platform/unix/SysThread.hpp:86:17: error: cannot convert 'pthread_t'
to 'uintptr_t' (aka 'unsigned long') without a conversion operator
return (uintptr_t)_threadID;
^~~~~~~~~~~~~~~~~~~~
/u/ts8004/git/ooRexx/common/platform/unix/SysThread.hpp:89:37: error: cannot convert 'pthread_t'
to 'size_t' (aka 'unsigned long') without a conversion operator
inline size_t hash() { return (((size_t)_threadID) >> :sunglasses: * 37; }
IBM warns about this in it's documentation
https://www.ibm.com/docs/en/i/7.1?topic=ssw_ibm_i_71/apis/concep17.html
Amazon have been fixing this bug in their C SDK
https://github.com/awslabs/aws-c-io/issues/217
There also appears to be bugs in SysThread where the "attached" member variable is not initialized
in the constructor that takes a pthread_t argument.
Ah, interesting that this is regarded a stumbling block, how about
pthread_getunique_np() or such then?
... cut ...
I you want to attract people to work on ooRexx then I suggest modernizing the development
pipeline. Move everything to Github. Nobody wants to use Subversion anymore and you can create
wikis and improve the documentation.
Sorry, there are lots of projects that use subversion, despite the big trend to Github and the
likes. Therefore there are some who also shadow ooRexx in github informally.
I would be interested to know to average age of the commiters.
Probably younger than you in the average! ;)
... cut ...
BSF4ooRexx even allows you to implement abstract Java methods in ooRexx, wich is actually very
easy! :)
Does it support lambda functions?
Of course! Java lambda functions get defined as interface classes. As I mentioned BSF4ooRexx adds
the ability to use Rexx classes to implement abstract Java methods and also Java interface classes.
Here an example which uses a Predicate and a Consumer function implemented in a Rexx class named
"Worker":
-- the Rexx class "Worker" see below implements the abstract function
methods in ooRexx methods
wordstring="Just a bunch of words to test for killer items containing a K."
arrWords =.bsf~new("java.lang.String", wordstring)~split(" ") -- returns a
Java String array
-- create a RexxProxy of our Worker class, tell Java the interfaces it
supports
rexxWorker=
BsfCreateRexxProxy(.worker~new,,"java.util.function.Predicate","java.util.function.Consumer")
clzArrays =bsf.loadClass("java.util.Arrays") -- load the Java class in order
to use its stream() method
-- create a stream use its "filter" (needs a Predicate function) method,
return an array
arr=clzArrays~stream(arrWords) ~filter(rexxWorker) ~toArray
say "words containing 'k' or 'K':"
say
do y over arr -- iterate over array, display its elements
say " ["y"]"
end
say
say "all words in array:"
say
-- create stream use its "forEach" method (needs a Consumer function):
accepts and displays every word
clzArrays~stream(arrWords) ~foreach(rexxWorker) -- accept each word (a
Consumer function)
*::requires BSF.CLS -- get the ooRexx-Java bridge***
-- Rexx class that implements two abstract Java methods in Rexx
*::class Worker*
-- implements the abstract method named "test" of the
"*java.util.function.Predicate*" interface
*::method test* -- will return .true for strings containing 'k', .false
else
use arg s -- fetch the argument (from Java) test it for containing
'k'
return s~caselessPos('k')>0 -- return result of comparison (0=.false or
1=.true)
-- implements the abstract method named "accept" of
the*"java.util.function.Consumer"* interface
*::method accept* -- will show each string
use arg s -- fetch the argument (from Java), do whatever we want
with it
say " ["s"]" -- enclose value in square brackets
Running the above program (it comes as samples/4-010_demo-j8-lambda.rxj with BSF4ooRexx) yields the
following output:
words containing 'k' or 'K':
[killer]
[K.]
all words in array:
[Just]
[a]
[bunch]
[of]
[words]
[to]
[test]
[for]
[killer]
[items]
[containing]
[a]
[K.]
... cut ...
The industry has spoken! Python is the most popular programming language in the world so haters
will have to just suck that up.
You realize that this is not true?
The popularity of a language is usually indirectly measured by analyzing the amount of queries on
search engines. This "indirectly" is the source of many misinterprations as the assumed correlations
may be wrong (cf. introductory courses into statistics for examples of this phenomenon).
And of course the industry does never "speak final", if that was the case no language besides
Assembler would have had ever a chance to get into industry, and yet it has been happening and will
continue to happen.
The major reason being that - unlike REXX, ooRexx and NetRexx - Python is *not* an easy
programming language for novices! (It is quite difficult to come up with an easy to learn, to use
and to understand programming language, the REXX language - and its families - stand out in that
respect.)
I disagree. It's simple to learn. It's hard to learn the standard library as it's so huge but that
comes with using it.
Well, I *know* watching novices from semester to semester. Some of them got a Python crash course
for a specific lecture and it is astonishing how limited their acquired skills and their
(conceptual) knowledge are. (Such students would appreciate what they were able to learn with
ooRexx+BSF4ooRexx.)
And for novices Python can be quite awkward and mysterious. Consider this simple Python script which
mandates an incredible amount of explanation and knowledge to be understood and to relate to before
a novice can start to understand what happens here why:
max=5
for a in range(1,max+1):
match a: # needs Python 3.10 or higher
case 1: print(str(a)+": first round")
case 2: print(str(a)+": second round")
case 3: print(str(a)+": third round")
case _: print("(a="+str(a)+")")
if a==max:
print("-> a==max")
print("-> last round!")
print("-> loop will end")
A "few" things you need to understand and hence teach to a novice: strict indentations (why?),
0-based (why?), range()-function (why?), str()-function (why?), "+" (why?), "match a" only from
Python version 3.10 up (why?), "case _" (why?), "==" (why?) ...
Contrast this with the equivalent REXX code:
max=5
do a=1 to max
select
when a=1 then say a": first round"
when a=2 then say a": second round"
when a=3 then say a": third round"
otherwise say "(a="a")"
end
if a=max then
do
say "-> a=max"
say "-> last round!"
say "-> loop will end"
end
end
The above code usually needs no explanations as it is simple, intuitive understandable: the English
keywords communicate the meaning of what they do; the code looks like pseudo-code, but is a real
program, simply REXX! (Barely a need to explain things down to gory details.)
Show both programs to a novice. Which of the two equivalent programs above do you think can be
easier - and faster - explained to and understood by a novice?
REXX, of course! It is the human-centric design philosophy of REXX that created such a "simple", yet
powerful programming language (it is actually very difficult to devise "easy" languages that are
powerful as one can witness in the field, so in this respect the REXX family of languages is really
outstanding).
The human-centricness is a major reason why it is possible to teach novices so much in REXX and
ooRexx and BSF4ooRexx (which makes Java look like ooRexx) in a single semester making it the most
important success factor for such an endeavor.
Take as an example your hint to <https://docs.python.org/3/library/selectors.html>: it is simply
impossible to teach novices in 90 minutes everything that is necessary to become able to write a
socket server and socket client as an assignment. Forget it if the novices are business
administration students who have no clues of Unix/Linux/POSIX nor a theoretical background of
what is documented there. T
I don't think anybody uses selectors these days. Modern Python has asyncio with co-routines and
async/await similar to JavaScript or Kotlin. It's so simple to write a high performance web
application.
Yes, but it was you who brought up that particular link in return to a posting that pointed you at a
REXX server and client sample after you asking whether any would exist at all for REXX. Now you say
"no one" would use these Python selectors these days and then jump to a totally different corner,
leading away from your own link which you just rendered useless yourself in your new argument?
... cut ...
---rony
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN