flat assembler
Message board for the users of flat assembler.

 flat assembler > Main > [fasmg] dot notation use cases...
Author
com2434

Joined: 11 Oct 2017
Posts: 1
Can anybody describe dot notation use cases in fasmg with exact description?
11 Oct 2017, 16:34
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7070
Location: Kraków, Poland
I don't know if you'd prefer just the basic use cases or even an exotic ones. I'll try to start with just a simple ones.

The basic idea is simple - a dot means that the symbol that follows is in the namespace of the "parent" symbol that preceded the dot:
Code:
```A = 'A'
A.a = 'A.a'
A.a.a = 'A.a.a'

namespace A
display a, 13,10                ; A.a
display a.a , 13,10             ; A.a.a
namespace a
display a, 13,10        ; A.a.a
display A, 13,10        ; A
end namespace
end namespace    ```
With NAMESPACE directive we can "enter" any given namespace and this changes the scope. Symbol that was defined as "A.a" outside, inside the "A" namespace can be accessed with just "a". Note that symbols from the outer namespaces can still be accessed simply by name, as long as there is no local symbol that would "overshadow" the global one:
Code:
```B = 'B'
B.B = 'B.B'
B.B.b = 'B.B.b'

namespace B
display B, 13,10                ; B.B
namespace B
display B, 13,10        ; B.B (because there is no B.B.B)
display b, 13,10        ; B.B.b
end namespace
end namespace    ```

When a symbol starts with a dot, it lies in the namespace of a label in the current namespace that was the most recently defined:
Code:
```C:
.a = 'C.a'

namespace C
display a, 13,10                ; C.a
end namespace

D:
D.a:
.b = 'D.b'

display D.b, 13,10                      ; D.b    ```
Note that the label "D.a" is a symbol named "a" in the "D" namespace. Therefore it does not change what label is the most recent one in the current (outermost) namespace, it is still "D".
11 Oct 2017, 17:32
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------Blog General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area

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