[ cyb / tech / λ / layer ] [ zzz / drg / lit / diy / art ] [ w / rpg / r ] [ q ] [ / ] [ popular / ???? / rules / radio / $$ / news ] [ volafile / uboa / sushi / LainTV / lewd ]

λ - programming

/lam/bda /lam/bda duck
Name
Email
Subject
Comment
File
Password (For file deletion.)

BUY LAINCHAN STICKERS HERE

STREAM » LainTV « STREAM

[Return][Go to bottom]

File: 1448479515017.png (34.79 KB, 563x440, semantic_highlighting.png) ImgOps iqdb

 No.12365

https://medium.com/@evnbr/coding-in-color-3a6db2743a1e#.56zigp1qh

I just read this article and wondered what lainchan thought of semmantic highlighting vs syntaxic highlighting ?

I think ssemantic highlighting could be a great help to avoid hours of debugging because of a typo in javascript, but I feel like it wouldn't matter that much in other languages. What do you think, lainons ?
>>

 No.12368

>>12365
I remember reading the article when it came out; at the time, I thought it was (at the very least) an interesting idea but there were no universal plugins for Vim IIRC.

After some time I found one for C & C++: http://www.vim.org/scripts/script.php?script_id=4945 and another one: https://github.com/jaxbot/semantic-highlight.vim
I've just tried the latter but it looks horrible in my terminal, so no cigar for now.

>>

 No.12379

Does it require a parser to implement properly? How well does a dumb regex approach like in >>12368 work?

>>

 No.12393

>>12365
I use languages that already have little syntax, like Lisp, Forth, and APL, so I don't see the utility it would have for these languages.

I do find the color in colorForth interesting, as it gives color a role in a program's semantic value. This not only makes code easier to read than having it all just black, but it also requires no parser, since you assign colors themselves, with each denoting a different attribute for the words.

I feel that the best way to avoid the problems you talk about to be to avoid them altogether. A typo in the name of something shouldn't warrant hours of debugging, unless maybe if you happen to accidentally type the name of something else by mistake.

Names shouldn't be visually similar enough to confuse in the first place, if you can help it.

>>

 No.12429

>>12393
>I use languages that already have little syntax, like Lisp, Forth, and APL, so I don't see the utility it would have for these languages.
Wouldn't coloring different variables be even more useful for these languages because they're so simple?

>>

 No.12432

>>12429
Forth doesn't have real variables. They're not distinguishable from procedures that return a value, so no.

APL also doesn't use variables much. A procedure can only accept two values and return one at most, so there's not a need to distinguish them beyond name. You can have local variables, but that's usually just for when you don't want to write everything on one line.

You could use it with Lisp, but I really don't see the point when coloring special forms and whatnot is usually more useful.

>>

 No.12433

>>12393
Today I was thinking it would probanly be helpful to have, for example

'(a b (c (d) e))

with the outermost parentheses in color c1 (say, red), including the quote. Then the atomic children (that is, a and b) in c2 (orange for example) and the parentheses surrounding (c (d) e) in c2 too. Then have c, e and the parenth4ses round d in c3 and d in c4.
With keywords in boldface, including lexical words

>>

 No.12451

>>12433
I used that when a sadistic uni professor made us write long ass predicates and lambda calculus on paper. Pretty neat.

>>

 No.12463

>>12433
Why not have quasiquote highlighting?

>>

 No.12464

Kdevelop has had that feature forever. Because it hasn't become staple feature of other ides and editors I assume it's not so good. Typically good ideas get copied immediately by everyone in tech.

>>

 No.12472

File: 1449198402660.jpg (55.46 KB, 600x900, 1417791130700.jpg) ImgOps Exif iqdb

>>12464
>Typically good ideas get copied immediately by everyone in

>>

 No.12483

my gut reaction to this is: Bad idea

syntax hilighting is usually computed using regular expressions - that's a very quick and limited language (sub-turing).

If you want semantic higlighting you would have to pull in a more complex language to figure things out and I imagine it being slow and not responsive as well as having added complexity which means more things could go wrong.



Delete Post [ ]
[ cyb / tech / λ / layer ] [ zzz / drg / lit / diy / art ] [ w / rpg / r ] [ q ] [ / ] [ popular / ???? / rules / radio / $$ / news ] [ volafile / uboa / sushi / LainTV / lewd ]