Why not '\' instead of '::' for modules?
Why not '\' instead of '::' for modules?
I've been trying modules and the current syntax looks pretty ugly in my opinion, the '\' operator is what PB uses for these things, why not use it?
In many cases the full name is requied
MyMod::DoSomething() ;ugly
MyMod\DoSomething() ;nice and PB like
And how about 'Using' instead of 'UseModule'? Like in C#, and make it valid only in the current file?
It's EndUsing really necessary?
In many cases the full name is requied
MyMod::DoSomething() ;ugly
MyMod\DoSomething() ;nice and PB like
And how about 'Using' instead of 'UseModule'? Like in C#, and make it valid only in the current file?
It's EndUsing really necessary?
Re: Why not '\' instead of '::' for modules?
\ is for structures:
in this case you can create "modules" without module ^^
Code: Select all
Prototype Test()
Procedure Example()
Debug "Hallo World!"
EndProcedure
Structure Example
MyFunction.Test
EndStructure
Define Test.Example\MyFunction = @Example()
Test\MyFunction()
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Why not '\' instead of '::' for modules?
Yes, I use prototypes in structures now.
Why does that prevent '\' as a module indicator? (Is there a name conflict with Structure & Module?)
Pros:
enables autocomplete with 1 keystroke instead of 2 '::'.
less clutter
Cons:
Module vs Structure does not jump out to reader.
Why does that prevent '\' as a module indicator? (Is there a name conflict with Structure & Module?)
Pros:
enables autocomplete with 1 keystroke instead of 2 '::'.
less clutter
Cons:
Module vs Structure does not jump out to reader.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Why not '\' instead of '::' for modules?
Structures and see also the help for "interfaces".I've been trying modules and the current syntax looks pretty ugly in my opinion, the '\' operator is what PB uses for these things, why not use it?
Academically discussed here, maybe you can tag along -> http://www.purebasic.fr/english/viewtop ... =3&t=55196And how about 'Using' instead of 'UseModule'?
UnuseModule ? It can be if you want to use UseModule instead of full qualifiers "::".It's EndUsing really necessary?
Code: Select all
DeclareModule x
Declare foo()
EndDeclareModule
Module x
Procedure foo()
Debug "x"
EndProcedure
EndModule
DeclareModule y
Declare foo()
EndDeclareModule
Module y
Procedure foo()
Debug "y"
EndProcedure
EndModule
UseModule x
foo()
UnuseModule x ; remove this and it doesn't work anymore
UseModule y
foo()
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Why not '\' instead of '::' for modules?
I totally agree with this request.
+1 for \ instead of ::
+1 for \ instead of ::
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Why not '\' instead of '::' for modules?
Disagree!
Let it stay as it is now (using ::).
Using \ can cause a conflict with the structures and interfaces! Why do it?
And also, will be confusing. You will need to think a module, structure, or interface.
Separator :: uniquely specify that this module.
Let it stay as it is now (using ::).
Using \ can cause a conflict with the structures and interfaces! Why do it?
And also, will be confusing. You will need to think a module, structure, or interface.
Separator :: uniquely specify that this module.
Re: Why not '\' instead of '::' for modules?
But at least a single character would be nice.
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: Why not '\' instead of '::' for modules?
There are languages that use the point '.' for everything. Structures, Namespaces, Interfaces, Classes, ...User_Russian wrote:Using \ can cause a conflict with the structures and interfaces! Why do it?
And also, will be confusing. You will need to think a module, structure, or interface.
So PB could also use the backslash for everything. If there is a name conflict, the compiler could say so.
Using the same name for structures, interfaces, modules could just be disabled and is not recommended
anyway. You can't use the same name for structures and interfaces anyway (and it is not a problem...):
Code: Select all
Interface theName
EndInterface
Structure theName
EndStructure
DeclareModule theName
EndDeclareModule

IMHO it wouldn't be a big problem to not use the same names for modules and structures/interfaces.
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Why not '\' instead of '::' for modules?
Really so hard to double-press the button?uwekel wrote:But at least a single character would be nice.
So what?Danilo wrote:There are languages that use the point '.' for everything. Structures, Namespaces, Interfaces, Classes
You forget that in many languages, for classes, and name space, it is used by two colons (::).
Re: Why not '\' instead of '::' for modules?
I'd also be in favor of '\' but it's not going to change anyway.
I'm just happy they chose '::' and not '_' which was announced...
I'm just happy they chose '::' and not '_' which was announced...
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: Why not '\' instead of '::' for modules?
Brrrr.... I'm an oldie and have been using things like busbar_n and busbar_nr for ages... I would have to rewrite ALL my code if they would have used _ !!!!!
Even though I can see the charm of \ I can live with ::
Even though I can see the charm of \ I can live with ::
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Why not '\' instead of '::' for modules?
Let us imagine that 25000 programmers have 5000 occurrences only, we would save 125 million keystrokes all togetherUser_Russian wrote:Really so hard to double-press the button?

PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: Why not '\' instead of '::' for modules?
If you imagine harder, doing search and replace would eliminate 124925000 of those keystrokes.uwekel wrote:Let us imagine that 25000 programmers have 5000 occurrences only, we would save 125 million keystrokes all togetherUser_Russian wrote:Really so hard to double-press the button?

Last edited by Demivec on Mon Jul 15, 2013 8:21 pm, edited 1 time in total.
Re: Why not '\' instead of '::' for modules?
If one character more (or one declare for that matter) is too much for you then you haven't understood the purpose of modules. Modules are about writing better (better readable, better testable, better maintainable, etc) code, not shorter code.
quidquid Latine dictum sit altum videtur
Re: Why not '\' instead of '::' for modules?
The sense of modules is out of question and do not - of course - depend on these single or double characters. I just think that a single character is better than two. That's all. But i think there is no single character left which is easy to reach on the keyboard 

PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2