HBUtil: new and extended commands

129 views
Skip to first unread message

Hurricane

unread,
Jun 11, 2025, 4:19:42 AMJun 11
to harbou...@googlegroups.com, harbou...@googlegroups.com
Suggestions for more modern and efficient code

1 - Declaration & initialization. Syntax:    
LOCAL|STATIC <var> AS <TYPE>

2 - Functions and methods, runtime parameter validation. Syntax:
FUNCTION | PROCEDURE | METHOD <name>( <var> [ = <v> | AS <TYPE> | AS CLASS <name> | AS BYREF ] [, <varN> ...] )
and attached image

3 - REQUIRED <var, ...> RETURN | THROW. Syntax:
REQUIRED <var, ...> [SIGNAL <name> | EVAL <expr> ] [ RETURN [<v>] | THROW ]
   
4 - Searches a value in another value. Syntax:
<v> IN <Value> // String, Array, Hash

5 - Functions and methods, return type validation at runtime. Syntax:
FUNCTION <name>([...]) AS <TYPE> | AS CLASS <TNameX>
METHOD <name>([...]) CLASS <TName> AS <TYPE> | AS CLASS <TNameX>
METHOD <TName>:<name>([...]) AS <TYPE> | AS CLASS <TNameX>
   
    If the return type is not as expected, throw an RTE with the appropriate description.

   <TYPE> = ARRAY, HASH, AHASH, CHARACTER, DATE, TIMESTAMP, NUMERIC, OBJECT, ... just simple checks
      INTEGER - simple check but convert number to integer
      DECIMAL|MONEY - simple check but convert number to decimal

   AS CLASS <name> = check class name or ancestor


Przemek*, would it be possible to implement item 5 in Harbour? (at a low level)
If this item is implemented, I will provide the source code of my implementations (items 1 to 4) for inclusion in Harbour (core or contrib) for anyone who wants to use it.
You implemented a function I suggested, but I only found out about it 16 months later... 🙂, so I recently implemented the AS BYREF check.


* or someone else

Regards,
Hurricane

cmd - function.png
Reply all
Reply to author
Forward
0 new messages