namespace problem

General FreeBASIC programming questions.
Site Admin
Posts: 3017
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada

Re: namespace problem

Postby coderJeff » Aug 17, 2019 21:16

fxm wrote:
coderJeff wrote:This seems like it should be the normal behaviour and correct that the definition should be fully qualified, either inside a namespace block, or with the namespace identifier prefix

But that works for a non-member procedure declared in a Namespace but outside implemented through a 'Using namespace_name':

OK, I'm trying to convince myself that unqualified (shortened) names would be OK after USING statement as a feature. While we do follow c++ naming rules for external linkage (ABI), the namespace/using concept is within the compiler only, so we don't necessarily have to copy c++ in every respect.

Here we should probably get an ambiguous symbol definition, as we don't reliably know if we are defining P() or N.P():

Code: Select all

declare sub P()

namespace N
   declare sub P()
end namespace

using N
sub P()
end sub

I have a few other cases I was playing with, but I am kind of thinking, it would be better to design the correct behaviour, and then go from there, to either fix bugs or add the features.

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest