Type method naming convetion?

BlitzMax Forums/BlitzMax Programming/Type method naming convetion?

PetBom(Posted 2005) [#1]
How am I supposed to find the method name for a specific type? Look at this TList example:
Global myList:TList = CreateList()

'This method is stated in the documentation...
ListAddLast(myList,"Something")

'This does the same thing
myList.Addlast("Something Else")
This would lead you to assume that all methods described as "ListSomething" is also implemented in the TList type as follows: Remove "List" from the method name and you've got the name of the type Method. But...
'Documented method...
ReverseList(myList)

'This does the same thing...
myList.Reverse()
How am I supposed to find (besides trial and error) the valid methods on a type?
The naming convention rule I just made up above obviously does not work since the name
of the general reverse method then would be "ListReverse". This type of confusing naming also appears in the TPixmap implementation (and perhaps other places).

I can't find anything in the documentation of what methods are implemented in each type (have I missed something in the docs?). I could live with not having the methods explicitly described, but then we need a naming convetion that we ca rely on. Has anyone else noticed this problem?

//PetBom


klepto2(Posted 2005) [#2]
I think there are 2 possible ways to find the right Method names.

First: You can look in the Modules themself to check the Methods and Functions.

Second: You can use an IDE with Autocompletion like BLide.

Also there are some (I think not all) mentioned in the Language Guide.


PetBom(Posted 2005) [#3]
First: You can look in the Modules themself to check the Methods and Functions.

This is what i've been doing. It's not that difficult, but I'm really trying to find out if other people see this as a problem, and then maybe report it as a bug.

If BlitzMax should be able to grow module-wise, it's really important that we have consistency how they operate. I think a general rule (as mentioned above) that you name general methods that are also implemented in the type "Typename" + "Methodname" is a good one. Then you'd know that if you remnove the name of the type, you get the method name. But if that is ever to happen, we must make sure that this is enforced early on. If this is a problem in the very basic modules, the problem will grow as we add more modules...

//PetBom


Robert(Posted 2005) [#4]
.


Robert(Posted 2005) [#5]
How am I supposed to find (besides trial and error) the valid methods on a type?


Look at the help files. Under the more recent versions of the IDE types and their methods are listed for each module.

I agree that some changes would be appropriate - I often try ListCount (when the correct name is CountList)


PetBom(Posted 2005) [#6]
Under the more recent versions of the IDE types and their methods are listed for each module.
You're right! How did I miss that?

That makes the naming problem a less significant. But I'd still like to see a revision

//PetBom