Page 1 of 3
Love PureBasic but hates that Procedures returns a value
Posted: Tue Jan 13, 2004 8:07 am
by techjunkie
Hi!
I LOVE PureBasic!!! - but HATES that a Procedure in Pure can return a value.
A Function returns a value, a Procedure NOT!!
But, I'll guess I have to live with it - even if it makes me sick...
Cheers!
Posted: Tue Jan 13, 2004 8:54 am
by Karbon
Why is that even an issue?
The way see it a procedure is just another name for a function....
Posted: Tue Jan 13, 2004 9:03 am
by legider_pb
Well, my answer is this:
This isn't Basic, this isn't C, this isn't C++, and this isn't any other language available... This is PureBasic. A language loved by many and scoffed by few.
In PureBasic "Procedures" are Functions, that is just what Fred and whatever other factors decided upon. Maybe he was drunk or high or not it doesn't matter to me cause I like it, it works. PureBasic is one hell of a language.

Posted: Tue Jan 13, 2004 9:59 am
by freak
legider_pb wrote:In PureBasic "Procedures" are Functions, that is just what Fred and whatever other factors decided upon. Maybe he was drunk or high or not it doesn't matter to me cause I like it, it works. PureBasic is one hell of a language.

My guess is that he was simply too lazy to add 2 different things for procedures/functions
Timo
Re: Love PureBasic but hates that Procedures returns a value
Posted: Tue Jan 13, 2004 10:05 am
by GPI
techjunkie wrote:I LOVE PureBasic!!! - but HATES that a Procedure in Pure can return a value.
What are the diffrents between a function and a procedure?
A function can return a value, nothing more. Why creating two things, when one is only needed?
Posted: Tue Jan 13, 2004 10:11 am
by techjunkie
legider_pb wrote:This isn't Basic, this isn't C, this isn't C++, and this isn't any other language available... This is PureBasic. A language loved by many and scoffed by few.
That's true - but as a "Computer Scientist" person I must say that you also have different groups of Computer Languages... Functional Languages, like C and Pascal, Incremental Languages like Lisp and Scheme... and many more.
When you have learned how one functional language works, it's pretty easy to learn another language in the same group.
If a language doesn't follow it's groups rules - it's hard to learn, it loses it's "soul" and you can't really see the languages real structure.
This isn't the case with Pure, but you have to be careful when you construct a language. You really can't do as you like - some principal rules have to be followed - or else, it is a dead language!
Like Amiga E Language - a stunning language, but it was hard to see the red line, because it had stolen from every language possible...
The language itself isn't important, but you MUST have a red line and a "soul"!
I'll rest my case...
and I really have posted this in the "General Discussion" section... NOT the "wish" section... *LOL*
Posted: Tue Jan 13, 2004 10:22 am
by techjunkie
One more thing... It's practical with both Procedures AND Functions - then you instantly see if it the call has return value or not...
Posted: Tue Jan 13, 2004 10:30 am
by GedB
In C a procedure is just a function that returns void.
In PB a function is a procedure that returns a value.
Same difference, really.
Posted: Tue Jan 13, 2004 11:43 am
by GPI
techjunkie wrote:One more thing... It's practical with both Procedures AND Functions - then you instantly see if it the call has return value or not...
And how will you change the call of a function?
Like all other (older) languages with a FN ?
Code: Select all
DefFunction Test(a,b)
EndFunction a*b
debug Fn Test(a,b)
...
And a little tip for you: When you write a procedure, that return a Value, definited it so:
Code: Select all
Procedure.l ThisReturn(a,b,c)
procedurereturn A*b*C
endprocedure
Procedure ThisNot(A,b,c)
debug A*B*C
endprocedure
So you see, when a procedure return a value.
Or when you like
Code: Select all
Procedure.l FN_ThisReturn(a,b,c)
procedurereturn A*b*C
endprocedure
Procedure ThisNot(A,b,c)
debug A*B*C
endprocedure
It is on you, how you will solve this "problem".
GPI
Posted: Tue Jan 13, 2004 1:08 pm
by techjunkie
GPI wrote:It is on you, how you will solve this "problem".
GPI
It's very simple... Look in any computer term lexicon and you have the answer...
Function <programming> Computing usage derives from the mathematical term but is much less strict. In programming (except in functional programming), a function may return different values each time it is called with the same argument values and may have side effects.
A procedure is a function which returns no value but has only side-effects. The C language, for example, has no procedures, only functions. ANSI C even defines a type, void, for the result of a function that has no result.
So PureBasic Procedures aren't really Procedures at all if you look at it from a strict Computer Science background...
Posted: Tue Jan 13, 2004 1:18 pm
by GPI
And a again: You see a problem, where no one is.
In PureBasic so many things are not-standard, for example Mid(): It should be Mid$().
Posted: Tue Jan 13, 2004 1:27 pm
by techjunkie
GPI wrote:And a again: You see a problem, where no one is.
I don't see a problem - I just like things to be called what they are when there is a name for it...
PureBasic Procedures ARE really Functions and they should have been called so from the beginning.
If you don't think it is important, why not call the compiler an intepreter? It doesn't matter... or?
As I wrote before - I can live with it, but it makes my stomach turn... :roll:
It's a general discussion... nothing more...
Posted: Tue Jan 13, 2004 1:29 pm
by Karbon
Tech: It seems you live in the world of academia, where you evidently have the time and inclination to worry about such things..
Personally, I couldn't care less...

Posted: Tue Jan 13, 2004 1:38 pm
by techjunkie
GPI wrote:In PureBasic so many things are not-standard, for example Mid(): It should be Mid$().
*LOL*
Yeah! But you get a hint of what Mid() do, don't you... Lucky Fred didn't call Mid(), Bof() or even Burp(). Hehe... or to confuse really... switched Right() and Left().
If I see a procedure in a programming language, any programming language - I'll never dream that it should return a return value... That's for functions to do...
Hope I have made my point clear...

Posted: Tue Jan 13, 2004 1:43 pm
by techjunkie
Karbon wrote:Tech: It seems you live in the world of academia, where you evidently have the time and inclination to worry about such things..
Personally, I couldn't care less...

Well, I'll guess I'm to old... *LOL* You can't make old dogs shit - or what do you say?
Have been programming since 1972 so - I'll guess I'm stuck with the "old terms", but still... I don't like it - OK? Hehe...