Namespace support for easy code reuse?

Just starting out? Need help? Post your questions and find answers here.
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Namespace support for easy code reuse?

Post by T4r4ntul4 »

How exactly does that work?

Do you have any sample code?
User avatar
SparrowhawkMMU
Posts: 291
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Namespace support for easy code reuse?

Post by SparrowhawkMMU »

Do you mean Modules or is there a new feature in v2?
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: Namespace support for easy code reuse?

Post by T4r4ntul4 »

look on https://www.spiderbasic.com/
by Features (scroll down)
User avatar
SparrowhawkMMU
Posts: 291
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Namespace support for easy code reuse?

Post 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
Last edited by SparrowhawkMMU on Wed Nov 16, 2016 10:53 am, edited 1 time in total.
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: Namespace support for easy code reuse?

Post by T4r4ntul4 »

Nowhere in the docs its saying that 'Namespace' is the same as 'Modules'.

Fred, can you shed some light on this?
User avatar
SparrowhawkMMU
Posts: 291
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Namespace support for easy code reuse?

Post 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
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: Namespace support for easy code reuse?

Post 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...
Post Reply