Vocabulary - Which word for functional entity in code? Command, Expression, Directive.

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
When rewriting the docs, I have some problems with choosing the right words:

First something I am pretty sure about. I am going to change the word "Identifier" to "...Name".
For example Function FunctionName:ReturnType(ParameterName:ParameterType)


The second thing is, that I don't have a suitable word for a functional entity that you usually have as one line of code.
I tend to use the word "Command", because it is usually not that well and rigidly defined compared to "Directive, Expression, Statement"

I see the need for this kind of didactical reduction to enable an easy to understand language without having to lookup every word in the docs while not using technical terms incorrectly
 

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
496
First thing sounds good. In the second case I don't really understand...? You're looking for a generic name that kinda hosts "directive, expression and/or statement", right? Why not term or phrase? I feel like command is a one-thing thing (like in command line tool, where you have a command followed by parameters. You could also check Unix manuals for how they call multi-command terms (e.g. when piped))
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
check Unix manuals for how they call multi-command terms
I will do that.

You're looking for a generic name that kinda hosts "directive, expression and/or statement"
Right, and also nearly everything else.
"Term" sounds to mathematical in my ears, while "phrase" sounds like multiple statements.

I feel like command is a one-thing thing
Yes, that's also true for old basic style where you didn't nest to many things in one line.
But I guess from a command line tool you are also used to have quite complex terms even if they are following this "command parameters" style, like "git config --global alias.br branch"
 

Arantor

New member
Joined
May 27, 2020
Messages
20
FWIW at someone who is a veteran programmer but new to CX...

A one-line piece of code that encapsulates its behaviour... that's a statement.

Code:
DrawImage myImage, 30, 50

A function call, yes, mechanically, but it's a statement. Even if you stack things on it like we did back in the BASIC days, that's still individual statements.

As far as:
Code:
Function FunctionName:ReturnType(ParameterName:ParameterType)

is concerned, that absolutely works, is unambiguous and while one could argue less technically correct, it's far more semantically useful.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
My two pence worth

An identifier can be either a variable, parameter, function or method name.

Terms to use:
Cerberus:
Function MyFunction:Int( parma1:int, param2:int)  << "Header" Function or Method Note the start of a class would be a header
A:       B:         C:   D:     E:   D:     E:

A Keyword Function or Method
B Function or Method 'identifier'
C Return Data Type
D Parameter identifier
E Parameter Data Type

ReturnVal  =  MyFunction( myval1,myvar2 ) << B: Function/Mehtod Call
A:         B: C:          D:     D:

A LValue identifier
B Assignment operator
C RValue function or method identifier
D Parameter identifier, function expression to pass

Local MyVar:Int  =  5 << Variable declaration
A:    B:         C: D:

A Keyword
B LValue Variable identifier
C Assignment Operator
D RValue can be a Literal, expression or identifier
 

Jimmy

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
912
Maybe a stupid question but.. Why should there be a differentiation between methods and functions? Is it purely because functions are supposed to give you something back in return of every call?
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
I am aware that there are different names for different things that can show up in a line, even if I am no expert in these terms.
What I am after is a word that describes all of them.
Just like you have apples, pears and cherries. You still need the word "fruit" to talk about these things.

If "statement" is the term to go. Is this technical term really fitting all the normal lines of code (line comments excluded) ?
like:
Strict
Import mojo
Local a:Int=5
Class Animal
ElseIf b>7
Until c = 5
#Rem
End

For native english speakers:
"Statement" has the german translation "Anweisung", which is nearly synonym to "command" in english. It seems "statement" has not really the same meaning as "command" and its range of possible meanings is pretty wide, right? I am looking for a term that describes the technical word "statement" (or whatever fits my needs here) in everyday language.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
For native english speakers:
"Statement" has the german translation "Anweisung", which is nearly synonym to "command" in english. It seems "statement" has not really the same meaning as "command" and its range of possible meanings is pretty wide, right? I am looking for a term that describes the technical word "statement" (or whatever fits my needs here) in everyday language.
You may as well just do what every programming manual since the first computer became available to the general public........
Have a glossary of terms used.
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
every programming manual since the first computer became available to the general public........
Have a glossary of terms used.
Maybe that is the reason why most of them are unreadable for beginners. To do that you could also just link to the explanation on wikipedia.
I want to make it readable for beginners without having to look up every second word.
 

ddabrahim

Active member
Tutorial Author
Joined
May 3, 2020
Messages
175
What I am after is a word that describes all of them.

Maybe the word you are looking for is Instruction?
Basically when you programming you are giving instructions what to do.

Assign this value to this variable
Check If this statement is true and if it is Then do this Else do that
Repeat this instruction(s) this many times using this Loop
Define a class with this name that extends from this other class and implements this Interface
Define the fields and methods of the class
Create an instance of an object
Call this method of this object
Set/Get the value of this object's property and this variables
..etc

All this can be described as an "Instruction" in my opinion. They are instructions.
 
Last edited:

Arantor

New member
Joined
May 27, 2020
Messages
20
Maybe a stupid question but.. Why should there be a differentiation between methods and functions? Is it purely because functions are supposed to give you something back in return of every call?

Because the language does, though in practice it's a semantic one.

Functions live generally, methods explicitly live in classes. A lot of languages just use the keyword 'function' to delineate that it's a function that operates on parameters and has a return, but Cerberus seems to delineate on scope rather than languages like VB where 'function' has a return and 'sub' does not.

I want to make it readable for beginners without having to look up every second word.

Then perhaps the way to go is to drop the formality behind terminology and be more descriptive. A function is 'a block of code that does x, you give it this parameter and this is the outcome'.

It's been a while since I really wrote documentation for beginners though :(
 
Top Bottom