Page 1 of 2
[Implemented] Compiler features
Posted: Thu Jan 27, 2005 7:27 pm
by Polo
Hi,
I've some request for the compiler :
One, not really important, but just wondering : why, in pb, we use the name of "procedure" instead of "function" like in the other basics ? Not important, but i just wanted to know

The other one, much more important, bu Fred already know it i think : I would like to get the possibility to add optionals parameters in a procedure, like in Blitz, and if possible to put it compatible with Tailbite
Code: Select all
Procedure MyFunction (param1,param2,optionalparam=0)
Endprocedure
Re: Compiler features
Posted: Thu Jan 27, 2005 7:33 pm
by Blade
Because functions and procedures are the same thing. The only difference is that the former returns a value.
So if you need a procedure, just write a function and do not return a value, or vice-versa
IMHO
Posted: Thu Jan 27, 2005 7:42 pm
by Polo
Yeah, I know they are the same things, that's why i'm wondering why not having them called Function

But i don't really care, i just wanted to know

Posted: Thu Jan 27, 2005 7:47 pm
by DarkDragon
Because some people say proc instead of func and so Windowfunc became Windowproc.

Posted: Thu Jan 27, 2005 8:01 pm
by blueznl
because gfabasic called them procedures?

Why call them anything at all?
Posted: Mon Jan 31, 2005 3:22 pm
by johndehope3
What I don't understand is why we have to call them anything at all? Instead of this...
Code: Select all
Procedure.s MyName() ... EndProcedure
What's wrong with this...
While I'm on the topic, how about just End instead of EndProcedure, EndIf, etc.
Also, why not Return instead of ProcedureReturn?
I think this would go a long way towards making PureBasic easier to code in.
Posted: Mon Jan 31, 2005 4:06 pm
by GedB
johndehope3,
I rather like the use of the different End syntaxes. It makes intention much easier.
Ruby just uses plain end and this can cause problems with matching ends if my whitespace ever goes out of line. This is a particular problem if code is being copied.
If the extra typing is bothering you just switch to japbe and let autocompletion take care of it.
Posted: Mon Jan 31, 2005 6:17 pm
by Polo
Anyway i hope fred plans to work on the optional parameter thing, because it would be a lot useful !!
Re: Why call them anything at all?
Posted: Mon Jan 31, 2005 7:07 pm
by freedimension
johndehope3 wrote:
What's wrong with this...
Answer:
Code: Select all
Proc1()
;Do weird things here
Proc2()
;Do even more weird things
EndProcedure
Now, what is the Procedure and what is just a procedure call?
Posted: Mon Jan 31, 2005 8:25 pm
by wcardoso
Well I think EndProcedure, EndIf, etc. is better than simply End because when the source file becomes bigger you can undestand more clearly the body of loops, procedures, etc. Specially if there are deep nesting
Re: Why call them anything at all?
Posted: Tue Feb 01, 2005 12:59 am
by Psychophanta
freedimension wrote:johndehope3 wrote:
What's wrong with this...
Answer:
Code: Select all
Proc1()
;Do weird things here
Proc2()
;Do even more weird things
EndProcedure
Now, what is the Procedure and what is just a procedure call?
What about EndProcedure Proc1()

BTW, i guess Fred preferred "Procedure" instead "Function" because he is a native french speaker

Posted: Tue Feb 01, 2005 5:11 am
by nco2k
is good, the way it is... :roll:
c ya,
nco2k
Posted: Tue Feb 01, 2005 6:18 pm
by Polo
>Psycho : I'm also native french speaker, and in french, instead of function we would say "fonction", but procedure ?? I don't like this word

But i don't care

Posted: Tue Feb 01, 2005 8:27 pm
by Psychophanta
Are you sure "Procedure" come not from french ??
"Bureau" is a word used in english, but it comes from french too.
Well, anyway then "Procedure" sure comes from Pascal computer language, don't?
Posted: Tue Feb 01, 2005 8:38 pm
by thefool
but anyway, a procedure RETURNS something, and a function DOES NOT!!!
so, if we change it, it would become OUT of standard, and we would have to change our source too! [not the hardest change, though]
thats the difference and it is in most other basics too!