Page 1 of 1
Namespace support for easy code reuse?
Posted: Tue Nov 15, 2016 1:59 pm
by T4r4ntul4
How exactly does that work?
Do you have any sample code?
Re: Namespace support for easy code reuse?
Posted: Tue Nov 15, 2016 4:05 pm
by SparrowhawkMMU
Do you mean Modules or is there a new feature in v2?
Re: Namespace support for easy code reuse?
Posted: Tue Nov 15, 2016 5:44 pm
by T4r4ntul4
look on
https://www.spiderbasic.com/
by Features (scroll down)
Re: Namespace support for easy code reuse?
Posted: Tue Nov 15, 2016 6:30 pm
by SparrowhawkMMU
Looks to me like that is probably referring to Modules as that is how SB and PB do namespacing.
I build all my code in modules, mainly for separation of concern but also for some reuse. Eg I have a DateTime module for some date functions not yet supported by SB, a Registry module for a global dictionary, I'm working on a local storage module, etc.
I tend to have a separate file for each module declaration too for maximum flexibility. Then my main file simply includes all the required files before opening the first window.
Edit: typos
Re: Namespace support for easy code reuse?
Posted: Wed Nov 16, 2016 10:16 am
by T4r4ntul4
Nowhere in the docs its saying that 'Namespace' is the same as 'Modules'.
Fred, can you shed some light on this?
Re: Namespace support for easy code reuse?
Posted: Wed Nov 16, 2016 10:19 am
by SparrowhawkMMU
In some other programming languages, modules are known as 'namespaces'.
From:
https://www.spiderbasic.com/documentati ... odule.html
I suspect Fred uses namespaces on the home page as that is the more common term in use outside of SB/PB. Although Xojo also uses modules to namespace, iirc
Re: Namespace support for easy code reuse?
Posted: Wed Nov 16, 2016 10:23 am
by T4r4ntul4
I understand now my own confusion....
When i search on some keyword in the docs it will light up in blue. When i did search for namespaces it will not light up in the docs, because its in brackets...