flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Heap > FASMG. access namespaces with index

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 88
Location: Russian Federation, Sochi
FASMG. access namespaces with index
Is it possible to provide access to namespace and its descendants throw its index?

general namespace and its descendants will have positive index from 0 for general up to 2^31.
local/blank namespaces will have same limit of negative indexes.

sintax of indexed access to namespaces could be "\Index.subitem" or "\index.\subindex".So "\0.anything" and just "anything" would mean the same.

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 12 Oct 2017, 07:00
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6633
Location: Kraków, Poland
One of my principal assumptions for the namespace features in fasmg was that they should be strongly relative - that is, you can embed an entire source in another namespace (for example to provide a separation from another one) and it should not be able to "notice" that its namespace is no longer the "true" root. All references have to be relative.
Post 12 Oct 2017, 07:29
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 88
Location: Russian Federation, Sochi
What mean it should not be able to "notice"?
If sequence .. in current namespace points to somewhere else that mean it isn`t "true" root, is it?
Post 12 Oct 2017, 07:43
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6633
Location: Kraków, Poland

ProMiNick wrote:
What mean it should not be able to "notice"?
If sequence .. in current namespace points to somewhere else that mean it isn`t "true" root, is it?

The .. sequence refers to a subspace of current namespace. There is no way to refer to the "parent" namespace in fasmg. The encapsulation provides a sandbox that you cannot simply break. If you put two "programs" in two parallel namespaces, they cannot access each others namespace unless the container provides explicitly with a way to do so - this is by design.
Post 12 Oct 2017, 07:50
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 88
Location: Russian Federation, Sochi
Ok, from child namespace it is impossible. From general namespace is it possible to declare tree of descendant namespaces with blank|local ones, so way that each child can acces whole that tree and each subelement of that tree?
Post 12 Oct 2017, 08:20
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6633
Location: Kraków, Poland

ProMiNick wrote:
Ok, from child namespace it is impossible. From general namespace is it possible to declare tree of descendant namespaces with blank|local ones, so way that each child can acces whole that tree and each subelement of that tree?

Yes, if you define a global symbol that is not redefined locally in any of the child namespaces, then you can use it access entire local tree from anywhere within that scope:

Code:
root = 'root'
namespace root
        a.b = '!'
        namespace a
                c = root.a.b
        end namespace
        display root.a.c
end namespace

Note that if you then take that entire source and embed it within another namespace, perhaps in a larger project, it is going to work the same, no matter that the "root" variable would be in a child namespace of some larger project. This is the "relativity" I mentioned.
Post 12 Oct 2017, 09:08
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 868
I wish C++ had namespaces like this (and disabled that ADL crap), would be much more useful than the current design. Razz
Post 12 Oct 2017, 11:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.