Prototype Parameter Lists - Default Value - What are the Simple numeric types?

Help Doc: Prototype Parameter Lists

= default A default value indicates the numeric parameter is omittable, and if omitted, the default value is passed. The OMITTED procedure will not detect the omission–a value is passed. Valid only on simple numeric types.

Help Doc: Base Types

The “normal” Base Type for each data type is:

Base Type LONG:

BYTE
SHORT
USHORT
LONG
DATE
TIME
Integer Constants
Strings declared with @P pictures

Base Type DECIMAL:
ULONG
DECIMAL
PDECIMAL
STRING(@Nx.y)
Decimal Constants

Base Type REAL:
SREAL
REAL
BFLOAT4
BFLOAT8
STRING(@Ex.y)
Scientific Notation Constants
Untyped (? and *?) Parameters

I’m building a class writing template with my quickly reassembled from memory Template Builder and am on the bit that handles defining parameters and am building a StrPos() to #Enable() the Default Value #Prompt()

This is the #Enable expression

(NOT %CWParameterPassByAddress) AND StrPos(%CWParameterDataType,'{{Byte|Short|Ushort|Long|Ulong|Date|Time|Decimal|PDecimal|Sreal|Real|Bfloat4|Bfloat8|\?}',%True)

Question.
So I have assumed the Long, Decimal and Real base types will be included but I havent included the data types listed below.

Should I also include the one’s listed below or just scale the #Enable expression back to NOT %CWParameterPassByAddress and just keep it flexible?

Base Type LONG:
Integer Constants
Strings declared with @P pictures

Base Type DECIMAL:
STRING(@Nx.y)
Decimal Constants

Base Type REAL:
STRING(@Ex.y)
Scientific Notation Constants

Opinions sought. :smiley:

TIA

Neither. Leave it as it is.

Read the Help you have quoted “Valid only on simple numeric types.”. This is about Value Parameters.

Wrong are Decimal and PDecimal which are Passed by Address.
Wrong is (? Arg) not a numeric type.


The Help lists all the types for By Value. I don’t see BFloat4 or 8, so you’ll have to test.

Value-parameters

Value-parameters are “passed by value.” A copy of the variable passed in the parameter list of the “calling” PROCEDURE is used in the “called” PROCEDURE. The “called” PROCEDURE cannot change the value of the variable passed to it by the “caller.” Simple assignment data conversion rules apply; Value-parameters actually passed are converted to the data type in the PROCEDURE prototype. Valid value-parameters are:

BYTE SHORT USHORT LONG ULONG SREAL REAL DATE TIME STRING


Why even ask here and paste volumes of Help? Take 5 minutes and write one Procedure with all your types with a =Default (BYTE B=1,..., BFloat8 B8=1, ? Q=1) and see what the compiler accepts. That’s all that matters, that is solid code. Should that test provide unexpected results then ask here about that code.

I think the composite screen shot will explain it better.

If the paramter is passed by value (ie the check box Pass By Address is not ticked), then if the Data Type matches whats in the the StrPos, the Default Value becomes enabled for the programmer to populate. CONST is only enabled if Pass by Address is ticked. Labels are optional So you cant make a bad parameter now unless you make a spelling mistake which is why I’m toying with making the data types a drop down list box in the their own right, with an option for defined types in the global or local data section of the appgen.

So I think its right, the question, is should I include those picture data types associated with the Long, Decimal & Real base types. For now I’m not gonna bother.

I’m colourising the Member Access because the UML symbols to denote Public, Protected or Private doesnt stand out enough in the list box, so will use Green for public, Yellow for Protected and Red for Private.

There is a Virtual checkbox to add the virtual attribute for derivation, but its behind the Member Access drop down.

And the embeds in the background demonstrate procedure (method) overloading works in a #Procedure template, with 3 different views (Tree, Standard or Both) to suit different programming styles.

Using Data to populate data definitions on a per procedure/method basis will also be operational, so a local data var, can populate into the selected procedures or all, by using the Data button, add var, select var’s Options tab, add User Option, select INI drop down list box. I’ve repurposed the wizatron functionality. :grinning_face:

And it all works in C6 or later.

Does anyone still use C6?
I wouldn’t really recommend anything earlier than C9

1 Like

C6 crashes less for me than C11.

Personally I think C6 is a very streamlined IDE, controls where you need them, non functioning controls & menu’s hidden when need be. More real estate for embed code, window designer, etc.

C7+ IDE, everything is on display, even stuff I dont need, to me its like being inside a cockpit of a jumbo jet. I know I argued for the C7 visual studio like IDE back in the C6 days, but I regret arguing for it now. And obviously I hate Visual Studio.

Sometimes, the latest version is not best.

Peak VW Golf is mk7.5 because its still got physical knobs to control things like heat, fan speed etc.

VW Golf mk8, got these stupid Google Android carplay controls, with touch controls that requires looking at the display and not the road.

However I’ll still write apps for cars, in native languages now I have my Template Builder working, I’m no longer restrained to just writing Clarion code using the templates. :grinning_face:

Templates are about making coding easy. Your Data Type entry should have a Drop List of all common types to pick as seen in the IDE. Must be a COMBO to allow entering anything.

Another CHECK option would be “Omittable” to wrap < xxx > and disable Default Value.

The Label can be different in the Map Prototype than the Procedure Parameters list. That way the MAP can be verbose and documenting, while the Parameter variable can be something to use in code and can be terse but descriptive.

Map:  LinesViewInList PROCEDURE(StringTheory STwithLinesSplitDone, <STRING WindowCaption>)

Clw:  LinesViewInList PROCEDURE(StringTheory LnzST,<STRING WinCapTxt>)

In C9 the Templates got Symbols for the Procedure Parameters do there is no need to write parse code, which I made an example and documented.

1 Like

Me! But I also realise I’m an oddball, since I haven’t written anything using a template or dictionary in 20 years :slight_smile:

And thats why I need a template, cuz my brain is getting old.

Only got a Drop() in templates, so I have a item #Enables a seperate #Prompt(‘’,@s255) for those situations.

(post deleted by author)

I think these are readonly symbols, like many of the built in symbols unfortunately.