Module Documentation

Everything else that doesn't fall into one of the other PB categories.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Module Documentation

Post by IdeasVacuum »

The Help describes the purpose of modules and gives a code example but:
1) Does not state the file type to be used (.pb, .pbi, .mod?)
2) Is there a file naming convention that ties-in with the module name?
3) Does not explain how to ensure the module can be "found" by the main code - for example, should the module file be saved in a folder that the compiler specifically "knows"?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Module Documentation

Post by Josh »

As there is no rule that modules have to be stored in own files, I can't see any need for such descriptions.
sorry for my bad english
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Module Documentation

Post by Demivec »

IdeasVacuum wrote:The Help describes the purpose of modules and gives a code example but:
1) Does not state the file type to be used (.pb, .pbi, .mod?)
2) Is there a file naming convention that ties-in with the module name?
3) Does not explain how to ensure the module can be "found" by the main code - for example, should the module file be saved in a folder that the compiler specifically "knows"?
Yes, none of those points are covered for modules, or any other files really. I thing a few guidelines would be helpful to promote at least some general standards.


Here is my perspective:

1. File types are a loose mix. There is no restriction on the name or the extension. Sticking with just .pb or .pbi, they are interchangeable.

If the file is not meant to be run in isolation it makes sense to name it using .pbi .

2. I haven't been able to discern any predictable patterns for file naming. Each programmer follows their own path for what is ideal. You would probably see (assuming .pbi files) each of the patterns of 'Module x.pbi' and 'x Module.pbi' or simply 'x.pbi'. I'm not sure which of those three I favor.

3. There is only one designated 'Source directory' in the preferences. That would leave each programmer to really develop there own system.

I've set aside a directory for Include files and IDE Tools. If Modules are being used as Include files then I place it in my directory for Includes.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Module Documentation

Post by IdeasVacuum »

Josh, if you don't store Modules in their own files, you defeat the object of being able to share them across unrelated projects. I am in favour of applying a distinct file extension, such as .pbm or .pbmod, since a module file is special.

My understanding of the .pbi extension is "include file", not appropriate for a module file since it is not applied in the same way.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module Documentation

Post by Little John »

Demivec wrote:If Modules are being used as Include files then I place it in my directory for Includes.
I do so, too.
IdeasVacuum wrote:1) Does not state the file type to be used (.pb, .pbi, .mod?)
If modules are being used as include files, then .pbi seems a proper file extension to me. I personally don't have any need to see from a file extension, whether the regarding include file contains code that is inside a module or code that is not inside a module. However, everyone is free to use file extension as s/he likes. File extensions are just conventions.
IdeasVacuum wrote:3) Does not explain how to ensure the module can be "found" by the main code - for example, should the module file be saved in a folder that the compiler specifically "knows"?
The compiler "sees" all code in each source file that it has "found". So the main question is, which files the compiler can find. And this is documented elsewhere. If modules are being used as Include files, then (X)IncludeFile should be used, obviously.

I don't actually see a lack of documentation here.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Module Documentation

Post by Andre »

I don't see a lack of documention, too.

But maybe collected suggestions and one or more examples about 'Using modules' could be added in a separate topic in the 'Beginners chapter' of the PB docs (see https://www.purebasic.com/documentation ... rview.html or here in the forum PureBasic Docs- Ideas/Help needed for a "We start" chapter!?)!?
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply