Hi Hurricane
This is very interesting. Is your code available to have a look?
Sadly I don't think I am "someone else" as this stuff is above my pay grade.
--
Regards
Alex
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 checksINTEGER - simple check but convert number to integerDECIMAL|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
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/412198075.2286773.1749627572836%40mail.yahoo.com.
No problem.
You can check the pending pull requests here:
https://github.com/harbour/core/pulls
Is it listed there?
The people who approve or reject pull requests usually reply to you if it gets rejected for some reason based on the rules:https://github.com/harbour/core/blob/master/README.md#how-to-participate
However, it’s up to you.
About syntax checking at build time:
Similar to TypeScript, when a variable doesn’t match its expected type (for example, trying to assign a numeric value to a string type), the build will either fail or show a warning for that line of code.
You can search for it—similar to what you are doing—but Harbour already offers a way to check syntax. If you run:
hbmk2 -n -s -q0 -w3 -es1
That’s what I’m talking about.
Hi,
I still don't understand how you did it and I'm curious to know.
Anyway i'd suggest that you move your work to the addons directory, that has very very similar features as contrib but is "personal", there should never be commits to that dir in github.
In this way you may publish your project on github, ask the users to clone into addons and rebuild harbour...
If harbour doesnt need to be rebuilt, it may be completely outside harbour dir...
--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/fc528d83-09a4-4b47-a9ba-6acb5d928012n%40googlegroups.com.