Brackets () arounds functions

BlitzMax Forums/BlitzMax Programming/Brackets () arounds functions

Matthew Smith(Posted 2005) [#1]
Would like to request that brackets are required around all function calls rather than just ones that are returning values.

Always thought this functionality was a pain when using VB6 and going to .Net confirms to me that bracketing everything is so much easier and cleaner.


rdodson41(Posted 2005) [#2]
Why? It is sometimes a pain to have to put brackets around everything when you just want to print some things when debugging. I like how it is now, where it is optional.


Russell(Posted 2005) [#3]
If you like it, then use brackets (parentheses, actually). If you don't, don't.

Simple and everyone's happy. :)

Russell


skn3(Posted 2005) [#4]
I would like if strict mode forced brackets.


Russell(Posted 2005) [#5]
Hmm.. How about two forms of strict mode (for those who want the normal requirements of Strict, but don't mind the bracket\no bracket requirement?

StrictBracket

or

Strict - <options>

Russell


BlitzSupport(Posted 2005) [#6]
I'm with Russell -- if you want to put brackets around everything there's nothing to stop you.

Jonathan's suggestion might be good -- more punishment for people who choose Strict mode.

(Standing up for lazy programmers since 1996!)


EOF(Posted 2005) [#7]
NO!!
bracketing everything is so much easier and cleaner.
Huh? ...
Graphics(640,480)
Text("Hello World",10,10)
Flip()
WaitKey()
End()

This still looks clean to me ...
Graphics 640,480
Text "Hello World",10,10
Flip
WaitKey
End


Commands = no brackets
functions = brackets

PureBasic brackets commands and functions and it's one of my pet hates.


skn3(Posted 2005) [#8]
But thats the reason behind the bracket idea. There is no such thing as a command, they are all functions. Splitting function calling into 2 different "classes" just confuses things. Personally I find it easier to program in a language where syntax is consistant.

There would be one big advantage with forcing brackets, there would never be any mixup with variables that share the same name as a function.


N(Posted 2005) [#9]
I'm with Russel. I don't think it should be forced outright, but having an option to force it would be good for those who want it. I wouldn't use it though 'cause I'm a lazy programmer.


EOF(Posted 2005) [#10]
I'm sure Mark could put in a 'VeryVeryStrict' directive for those who want to waste time reading a long list of error reports because they forgot to put () around one command.

One nice thing about Blitz(Max) is its easy/relaxed approach to coding. Lets keep it that way.


Dreamora(Posted 2005) [#11]
there is a difference between functions and commands ( or known as methods as well ):

functions change and have a return value
methods change but don't return anything

there would be a third type of functionality: query

return but don't change anything


everything without a return has no real need for () as the () is to encapsulate input if you want to use the output straight as new "object" with .blabla


FlameDuck(Posted 2005) [#12]
There is no such thing as a command, they are all functions.
No. Actually most are statements. A function takes it's word from the wonderful world of mathematics, such as for instance: y = f(x) = x^2*sin(x).

As can be clearly said for something to be a function it must have two properties. It must take an input value (x in this case) and have an output value (f(x) or y in this case). Thus it is possible to find one corresponding output value for any given input.

Any command that does not have these two properties is a statement or procedure (statement if it has neither input or output, procedure if it has either input or output).

methods change but don't return anything
That's not a very accurate definition.

Traditionally the () is there to distinguish between methods and fields, as many languages (traditionally C++, but also newer languages) allow you to have a "xposition" field and an "xposition" method. Now since the C++ compiler, for some reason must be a single pass compiler, it needs to know which member you are trying to access, the field or the method. Thus() the() need() to() postfix() absolutely() everything().