flat assembler
Message board for the users of flat assembler.

Index > Main > [fasmg] Suggestion: Special Unnamed Namespaces Documentation

Author
Thread Post new topic Reply to topic
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 05:14
A namespace notation whose name is unresolved (e.g. no label) refers to the unique special unnamed namespace that corresponds to the number of dots. Instead of calling these "special unnamed namespaces" we could call them namespace 1, 2, 3, ... based on the number of dots.

E.g.:
. refers to (special) namespace 1
.. refers to (special) namespace 2
... refers to (special) namespace 3
and so forth
Post 08 Jun 2025, 05:14
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 05:28
That might conflict with actual namespace 1,2,3 though.

Terminology is difficult when the language has such flexibility.
Post 08 Jun 2025, 05:28
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 05:32
Can a non-special namespace have a name that starts with a number?
Post 08 Jun 2025, 05:32
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 05:41
Code:
namespace ?1
end namespace    
Post 08 Jun 2025, 05:41
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 05:47
Documentation:
Quote:
Numbers are distinguished from names by the fact that they either begin with a decimal digit, ...


Is your example an exception to the concept (rule) that a name does not begin with a decimal digit?

Perhaps the '?' suppresses the interpretation as a number.


Last edited by Greg_M on 08 Jun 2025, 06:27; edited 2 times in total
Post 08 Jun 2025, 05:47
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 06:06
Greg_M wrote:
Perhaps the '?' suppresses the interpretation as a number.
This is true. In a larger context the namespace can be used without the question mark.
Code:
namespace tester
        namespace ?1
                grape = 1
        end namespace
end namespace

repeat tester.1.grape
        display 'Hello World!'
end repeat    
... quite useful feature, tbh.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 Jun 2025, 06:06
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 06:18
I appreciate the example. Then, with regard to the point of my OP, one could call the namespaces:

. Special Namespace 1
.. Special Namespace 2
... Special Namespace 3
and so forth
Post 08 Jun 2025, 06:18
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 06:29
"unnamed" seems more literal to me. Also, I always imagine there could be other "special" namespaces in the future, and it reduces the need to re-learn old concepts with new names. The language certainly has corners. Maybe different naming would see these special namespaces with more use?

I just think the manual is very dense and could probably be expand to a 500 page manual with extensive examples. Only so many hours in a day.
Post 08 Jun 2025, 06:29
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 06:45
It's a suggestion. No need to rush a decision. As a very recent (new) student of FASM, I can offer an objective experience/perspective. I.e. I understood the concept, but I think that a specific moniker is helpful to me when I encounter documentation of syntax that corresponds to a uniquely identified entity, as is the case for the specific namespace that corresponds to a specific number of dots.

The goal is to be helpful, of course. FASM appears to be a powerful tool, so it's worthy of large growth/uptake IMO. Granted, assembly is not a popular language in general, but I think FASM could even change that e.g. grow as a tool for higher-level language development as an abstraction layer above the machine. fasmg appears to be geared toward this.

(I have an assembly/C/C++/C#/F#/JavaScript/HTML/CSS background and am interested in memory safety language features for C as well as a language with modern syntax. I'm excited to have found fasm/fasmg. I have encountered fasm, e.g. in web searches over the years, but only recently made the decision to use assembly language and learn and use fasm.)

Ironically, even your exposition that a number could be used as a namespace name by use of preceding '?' could perhaps be clearer in the documentation:
Quote:
"?" character ... used in a context where identifier could mean something different than a label or variable to be defined.

So, neither a label nor a variable can ever begin with a decimal digit. These entities and other types of named entities, such as namespaces could be introduced along with which ones the '?' is applicable to. I think that, e.g., a table of all named entity kinds and a column for whether they can ever begin with a decimal digit and a column for whether '?' can override and what '?' can override, would help delineate the various possibilities.


Last edited by Greg_M on 08 Jun 2025, 07:30; edited 2 times in total
Post 08 Jun 2025, 06:45
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 07:17
I'm sorry if it seemed like I was down-playing your feedback - that is certainly not my intent.

The nuance you've reflected on regarding '?' might arises because it was added later - it becomes an exception to prior statements. Hence, why it concludes section two:
the manual wrote:
Any identifier can be prepended with a ? character and such modifier has an effect when it is used in a context where identifier could mean something different than a label or variable to be defined. This modifier then suppresses any other interpretation.

A number can be used in a role of a name inside an identifier, but not when it is placed at the beginning, because then it is considered a literal value. This restriction also may be bypassed by prepending an identifier with ?.
Perhaps that last paragraph could be worded differently to make it clear a number is prepended with a '?' becomes an identifier.


Last edited by bitRAKE on 08 Jun 2025, 07:35; edited 1 time in total
Post 08 Jun 2025, 07:17
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 07:28
No problem at all, and thank you. You entertained my feedback and shared your thoughts. Discussing, itself is a good exercise for my learning. I can see that fasmg has rich capabilities and I have much to learn. Smile
Post 08 Jun 2025, 07:28
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8434
Location: Kraków, Poland
Tomasz Grysztar 08 Jun 2025, 10:14
bitRAKE wrote:
Perhaps that last paragraph could be worded differently to make it clear a number is prepended with a '?' becomes an identifier.
I added a small example. My preferred solution is to give more examples, thus I've been adding more of them recently.
Post 08 Jun 2025, 10:14
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 16:47
Sounds great. Agree, examples are the crestal explanation.
Post 08 Jun 2025, 16:47
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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.