new keyword suggestion: #package

For other topics related to the FreeBASIC project or its community.
RockTheSchock
Posts: 226
Joined: Mar 12, 2006 16:25

new keyword suggestion: #package

Postby RockTheSchock » Jun 22, 2016 16:02

I would like to see some sort of simpler package/namespace management.

A "#package ..." statement could automatically insert
End Namespace before "#include ..." and
"Namespace ..." after includes.

What do you think?

example code

Code: Select all

package tld.mydomain.mypackage
#Include Once "point.bi"
#Include Once "awtobject.bi"

Type Component extends AWTObject
   Declare Constructor()
Private:
   location as Point
   h As Integer
   w As Integer
   '....
End Type


would be expanded to

Code: Select all

Namespace tld.mydomain.mypackage

End Namespace
#Include Once "point.bi"
Namespace tld.mydomain.mypackage

End Namespace
#Include Once "awtobject.bi"
Namespace tld.mydomain.mypackage


Type Component extends AWTObject
   Declare Constructor()
Private:
   location as Point
   h As Integer
   w As Integer
   '....
End Type

End Namespace
St_W
Posts: 1483
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: new keyword suggestion: #package

Postby St_W » Jun 22, 2016 16:48

I don't see a reason for something like that.

Put your #includes on top and then open a Namespace, like in C++. Having #includes somewhere in the middle of the code is bad style anyway.

Code: Select all

#Include Once "point.bi"
#Include Once "awtobject.bi"

Namespace tld.mydomain.mypackage

Type Component extends AWTObject
   '....
End Type

End Namespace
caseih
Posts: 1425
Joined: Feb 26, 2007 5:32

Re: new keyword suggestion: #package

Postby caseih » Jun 23, 2016 3:24

Agree with St_W. What shortcomings do the existing namespaces have in your opinion, and what problems are you trying to solve?

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests