new keyword suggestion: #package

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
RockTheSchock
Posts: 252
Joined: Mar 12, 2006 16:25

new keyword suggestion: #package

Post by RockTheSchock »

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: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: new keyword suggestion: #package

Post by St_W »

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: 2157
Joined: Feb 26, 2007 5:32

Re: new keyword suggestion: #package

Post by caseih »

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