code folding

Inquie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 14 09:58:21 PDT 2017


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 though I'd 
>> rather have proper code structuring support in general). 
>> Generally when even a hint of a suggestion of a language 
>> addition is created, the worms come out to party...
>
> 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 good reason). If 
> any new feature is going to have any hope of getting in these 
> days, then it needs someone to champion it through the DIP 
> process.

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:

"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 when folded. A comment helps but still kinda ugly.

C# has #regions and hopefully D has something as useful.
"

No where do I mention anything about a language change. I asked 
if D had something useful and better than my hack. What it seems 
to stir up is a bunch of people that have a fear based reaction, 
which I can only hypothesize why. Usually it involves someone 
trying to state absolutely why what I am doing is wrong or bad 
and all they offer is anecdotal evidence and their opinions. None 
of which are helpful or useful.

I would wager that more than 50% of D users have this mentality, 
and given that, it is highly unlikely that I could push for such 
changes. I'd get more done and have more use by forking D and 
adding my own features for my own personal use.

What perplexes me is why so many have such a disdain for any 
change that ultimately doesn't effect them much. If, say the 
"#regions" feature was implement, or some variant, and they are 
right and it is useless then chances of them ever encountering 
such code is slim... and code they do encounter would generally 
not a a problem(light use). Yet, those that do use it(in house), 
which, if it is so bad, according to them, should be rare, would 
benefit from it, at least in their own mind.

You know, there is something called "Survival of the fittest" and 
if an idea is truly bad then it will die out. Many people don't 
even want to give any idea a chance to go through that process... 
fear of it being successful? Fear they might have to learn 
something new? Fear it might require them to adapt their 
understanding of how things work? Fear of it being a waste of 
time? Fear of it causing a nuclear meltdown? When it will affect 
them almost nil, and they rail against it, it is some deep seeded 
fear from something... Unless they can give nearly absolute 
mathematical proof why it is invalid/wrong.

Anyways, my hack is good enough for me. If they ever see any of 
my code, they might rather have allowed something a bit more 
syntactically pleasing and so they can blame themselves(which 
they won't). Of course, we could always depreciate "static if 
(true)" to prevent that possibility! Maybe that is the real 
solution?












More information about the Digitalmars-d-learn mailing list