Re: code folding

2017-03-18 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: Does D have any nice way to specify a block for cold folding? I have a very large set of structs and I'd like to be able to code fold them all at once and together. I have been using static if(true) { ... junk } but the static if is

Re: code folding

2017-03-17 Thread Entity325` via Digitalmars-d-learn
On Saturday, 18 March 2017 at 05:00:48 UTC, Entity325` wrote: and both create a scope outside of which no declarations inside them are visible(potentially undesirable side-effects). Oh. Static ifs don't do that. Disregard, I'm wrong.

code folding

2017-03-17 Thread Entity325` via Digitalmars-d-learn
FYI, static if(true)//comments are great for adding some context to your code. { //stuff } and {//let's toss a comment on the scope declaration! //stuff } are functionally equivalent in my IDE. Both will fold down to only the top {(good), and both create a scope outside of which no dec

Re: code folding

2017-03-14 Thread Ali Çehreli via Digitalmars-d-learn
On 03/14/2017 02:48 PM, Inquie wrote: >> version (all) { >> // ... >> } >> >> You can define your own version identifiers as well: >> >> version = some_descriptive_name; >> >> version (some_descriptive_name) { >> // ... >> } >> >> Ali > > Oh, that might be better. I thought of versions bu

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 20:56:02 UTC, Ali Çehreli wrote: On 03/13/2017 10:29 AM, Inquie wrote: Does D have any nice way to specify a block for cold folding? I have a very large set of structs and I'd like to be able to code fold them all at once and together. I have been using static if

Re: code folding

2017-03-14 Thread Ali Çehreli via Digitalmars-d-learn
On 03/13/2017 10:29 AM, Inquie wrote: Does D have any nice way to specify a block for cold folding? I have a very large set of structs and I'd like to be able to code fold them all at once and together. I have been using static if(true) { ... junk } but the static if is uninformative since

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 17:07:57 UTC, Adam D. Ruppe wrote: On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: Does D have any nice way to specify a block for cold folding? I personally sometimes use // some description { // } since my editor does a really good job matching {}, eve

Re: code folding

2017-03-14 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 16:58:21 UTC, Inquie wrote: On Tuesday, 14 March 2017 at 16:29:15 UTC, Mike Parker wrote: [...] It's not that I feel strongly about, I simply would like the best useable solution. Like usually what happens, my original post was taken completely out of context:

Re: code folding

2017-03-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: Does D have any nice way to specify a block for cold folding? I personally sometimes use // some description { // } since my editor does a really good job matching {}, even in comments so it is convenient to jump anywhere, and i can se

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 16:29:15 UTC, Mike Parker wrote: On Tuesday, 14 March 2017 at 15:44:27 UTC, Inquie wrote: So, with all the bloviating, all I have arrived at is that my original hack is still the only way to get the cold folding I wanted(the original use case I had in mind, even

Re: code folding

2017-03-14 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 16:29:15 UTC, Mike Parker wrote: If it's something you feel strongly about, then the way to go about it is to put together a DIP. There was a time when you could open a forum post about a new feature and eventually see it added, but those days are long gone (for go

Re: code folding

2017-03-14 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 15:44:27 UTC, Inquie wrote: So, with all the bloviating, all I have arrived at is that my original hack is still the only way to get the cold folding I wanted(the original use case I had in mind, even though I'd rather have proper code structuring support in gene

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
with D in the first place. I do not use Emacs but the Visual D, which I assume is the sponsored IDE for D. This is an issue for the IDE, not for the language, and changing the language would not have any effect on IDE support for code folding. Remember, it is not just about code folding(whic

Re: code folding

2017-03-14 Thread bachmeier via Digitalmars-d-learn
s: https://www.emacswiki.org/emacs/FoldingMode This is an issue for the IDE, not for the language, and changing the language would not have any effect on IDE support for code folding.

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
Just for fun: 1. Folding directives are glorified comments. #region has zero meaning to the compiler; it's a hint to the editor to allow code folding. It doesn't do any namespacing or scoping. Why, exactly, are we writing code to accommodate the editor? It boggles my mind tha

Re: code folding

2017-03-14 Thread Inquie via Digitalmars-d-learn
file can be visibly reduced. If you have enough declarations in one file that they call for code folding, it may be better to move them to a separate module. Public imports and aliases allow doing this without breaking any code. Maybe, maybe not... proves nothing as it is just your preference

Re: code folding

2017-03-13 Thread XavierAP via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 00:38:12 UTC, Vladimir Panteleev wrote: If you have enough declarations in one file that they call for code folding, it may be better to move them to a separate module. Public imports and aliases allow doing this without breaking any code. [...] Generally

Re: code folding

2017-03-13 Thread Vladimir Panteleev via Digitalmars-d-learn
ypes in a single file, it is nice to be able to fold them. It is also nice to be able to group them in some way(hence the question) and fold the group so that large chunks of the file can be visibly reduced. If you have enough declarations in one file that they call for code folding, it may be

Re: code folding

2017-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
... junk > >> > >> } > >> > >> but the static if is uninformative since that is the only line > >> that is shown when folded. A comment helps but still kinda > >> ugly. > >> > >> C# has #regions and hopefully D has something a

Re: code folding

2017-03-13 Thread bachmeier via Digitalmars-d-learn
not a comment). From my understanding of the feature, it does the same as // region ... code to be folded ... // endregion An IDE can then read those comments and allow code folding. It might meet some definition of a language feature, but it is nothing more than a comment. I use visual studio a

Re: code folding

2017-03-13 Thread Inquie via Digitalmars-d-learn
On Monday, 13 March 2017 at 21:17:31 UTC, XavierAP wrote: On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: I have been using static if(true) { ... junk } Indeed #region is part of the C# specification, even if it has no effect on the code. (The specification does not say anything

Re: code folding

2017-03-13 Thread XavierAP via Digitalmars-d-learn
On Monday, 13 March 2017 at 17:29:41 UTC, Inquie wrote: I have been using static if(true) { ... junk } Indeed #region is part of the C# specification, even if it has no effect on the code. (The specification does not say anything about folding/collapsing, just about "marking sections of

Re: code folding

2017-03-13 Thread Inquie via Digitalmars-d-learn
e and together. I have been using static if(true) { ... junk } but the static if is uninformative since that is the only line that is shown when folded. A comment helps but still kinda ugly. C# has #regions and hopefully D has something as useful. Code-folding is an IDE thing,

Re: code folding

2017-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
g > > static if(true) > { > ... junk > } > > but the static if is uninformative since that is the only line > that is shown when folded. A comment helps but still kinda ugly. > > C# has #regions and hopefully D has something as useful. Code-folding is an IDE thing, not a l

code folding

2017-03-13 Thread Inquie via Digitalmars-d-learn
Does D have any nice way to specify a block for cold folding? I have a very large set of structs and I'd like to be able to code fold them all at once and together. I have been using static if(true) { ... junk } but the static if is uninformative since that is the only line that is shown