single-line string?

spir denis.spir at gmail.com
Thu Apr 14 07:49:58 PDT 2011


Hello,

This may be a feature request for a single-line string syntactic form --if ever 
others are annoyed as well, see below. One possible form may be:
     str = s"abc";
I have myself long found it stupid to separate single- and multi-line string, 
since there is no formal reason for that. But there are practical consequences 
on code edition I did not imagine until I started coding in a language not 
making this distinction... namely D.

Problem:

In my editor, Geany, each time I press '"', the whole code (actually the rest 
of the code from the current cursor position) is re-scanned, re-interpreted, 
re-displayed. This is fully logical and in itself is not a major issue in Geany 
because it is very light & fast. I wonder how this goes with heavier editors or 
real IDEs.
But the real point is that this causes a big usability problem, namely that all 
(the rest of) code suddenly gets unfolded! If I want to go on editing 
comfortably, I then need to refold all and manually re-unfold the part(s) I'm 
currently working on. Very annoying. Imagine a debugging session requiring 
debug prints here & there...

This is a bug of the editor, indeed, but since Geany is based on Scintilla's 
editon component, I guess this bug may be widely shared. A solution may be that 
opening of a (possibly multi-line) string should limit the reinterpretation 
scope to the current logical line, or simply suspend it, until either the 
string is closed, or said line is quit (via arrows or mouse). Also, the bug 
happens even if I use Geany's feature of auto-closing delimiters, meaning when 
I press '"' '""' is written out (a feature I hate anyway for code edition). I 
would like to know how & how well other editors deal with all of that 
(especially but not only emacs and vim).

Compare with multi-line comments: the difference is double: (1) there is syntax 
for single-line comment (2) the closing delimiter is different ('/*' vs '*/'). 
This means that (1) use of multi-line syntax is limited to actual need for 
multi-line (2) one can avoid the bug by writing the closing delimiter first, 
hehe! (what I constantly do when writing docs docs)

Any comment ot hint welcome.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list