On 26 August 2011 22:49, Alexander Eberspächer <alex.eberspaec...@gmail.com> wrote: > Hey Lex, hello list, > > On Fri, 26 Aug 2011 22:04:01 +1000 > Lex Trotman <ele...@gmail.com> wrote: > >> > The snippets for the loops assume that the counting variable is >> > shall be i. >> Thats traditional... > > But still making a rather strong assumptions about what the user wants.
As I said below, in C++ there are more options that don't use a simple counter, so IMHO the fully blank for you suggested would be better for C++ rather than caring what a counter is called. > >> For C++ its fine to re-declare i within the loop, it will hide any >> external declaration. > > Okay, didn't remember that. Is that true for C# and Java also? Don't know them enough. [...] > Any other opinions on that? Your suggestions breaks consistency with > C/C#/PHP... Well I thought part of the reason for separating them into individual languages was so each could be customised for the language, there is no reason for them to be the same. > >> Maybe you should preserve default behavior on the basis that someone >> decided it to be that way, unless you know no one cares. > I should be more clear too, I mean that where there is a specific snippet for a language lets get other opinions before changing the behavior. For things that were default and are now language specific, then there is no problem with customising it to suit the language. > I want to make my point about assumptions a bit clearer: if a user > writes 'for' in C program and hits the completion key, one can be sure > that this user wants a for loop. However, you cannot (and IMHO, to keep > snippets useful for any user, must not) be sure that the user wants 'i' > to be the counting variable. The more I think about it the more options there are for C as well, eg null terminated for(p=something; *p; p++), linked for(p=something; p; p=p->next) as well as the counter so I don't know, maybe C should be blank as well, after all the if, while and do while are blank, or maybe for(%cursor%; %cursor%; %cursor% )? > > So, what do other people think? The patch should not break what people > actually use. However, a *consistent* set of snippets uses either a > default counting variable for all languages or doesn't fill in any at > all. IMHO consistency between languages is less important than being most appropriate for the language. Files can only have one filetype so you can't see the inconsistencies between languages without switching files anyway. > >> I dunno, all the sigmas I remember used i & j, and in original fortran >> all variables starting with i to n were integers, so again tradition >> has it to use i,j,k,l,m,n. > > That's Fortran 77. From Fortran 90 on, there is the 'implicit none' > statement that tells the compiler not to use implied types. I've already > added a snippet for that. Of course you shouldn't use implicit types, but there is lots of existing code and a practice that indexes are i,j, etc > >> PS You seem to have got a copy of the for entry tacked on to the end >> of the switch snippet for C++ & C# > > Oops. Fixed (patch attached). > >> PPS there seem to be line breaks in some entries, (eg switch) entries >> must be on one line > > Can't see any line breaks. Ok, just me being confused by Gedits line wrapping (thats what patch attachments default open in, I must change that to Geany). Cheers Lex > > So I hope there will be some discussion on what the default snippets > should do. I am happy to create a patch that does just whatever the > discussion results in. > > Cheers > > Alex > _______________________________________________ > Geany-devel mailing list > Geany-devel@uvena.de > https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel > > _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel