Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)R
Posts
6
Comments
83
Joined
2 yr. ago

  • Every languages has their own pitfalls. The answer on picking a language is to pick whatever works for you. There may be even domain-specific languages if you're interested in a domain, and it can be way more flexible than general-purpose solutions for that domain too.

    I use 4 languages.

    1. C++ for adding features to a program.
    2. C# for making .dll for an application (Paint.NET). Kinda similar purpose to what I do with G'MIC, except so much more limited.
    3. Python for processing strings
    4. G'MIC for creating/editing raster graphics images (volumetric too)

    Now, I wish there was a vector equivalent to G'MIC, but there isn't.

  • Also, highlighted the way you expect when you click next to braces works too.

  • Here's my opinion, a well-developed DSL could even be arguably more flexible than say Python even with existing libraries on their specific domains. So, if one is just limited to domains, they may be very well be preferable to general languages.

    I have coded in C#, Python, C++, and currently nearly everyday, G'MIC. Which one of those are a DSL? The last one. What it is? It's a Domain-Specific Language that has been geared toward raster graphics image processing. Why do I use it? Looking at the stack-based processing, commands, built-in mathematical functions. It seems that it has a lot more things that are built-in than say Pillow library for Python and other things. And I only do create images with code, so I am happy with this, and I even did things like Python itertools combinatorics with more things like rank2list/list2rank variation of those combinatorics which aren't image processing by themselves, but can aid to it.

    If I feel that it is way too limited for that Domain, then I wouldn't use it. DSLs are only good if the other options are much more difficult to build with and their flexibility are often enough to entice their audience which is one with limited use cases. Of course, generic languages are usually better even than most DSL even within their domains because of wider support, and wider audience. More DSLs would be better than generics given enough time and support for their domains in my opinion.

  • Braces too can be wrong. But, one is less likely to get it wrong. Modern editors often allows one to highlight matching braces immediately after selection, and rainbow braces(if available) makes it clear on the nest level.

  • I didn't say it doesn't help. But, it alone does not really help for bad and long code, but you are correct in that it would be worse with the wrong indentation. Like you pointed out, the program could do the wrong thing if there is a wrong indentation where indentation matters which is one of my issue with something like Python. And languages with explicit exit scope tend to not have that issue while adding to the benefit of making longer code readable. Where white-space sensitive languages really shine on in my opinion are small codes, and that's where I think of using Python.

  • From some one who used Python as it was the easiest solution to few of my problems, and having to experience languages with brackets and/or endif/fi/done as ways to limit scope, I find that having things like brackets and/or scope terminators easier to parse and less error-prone. I'm thinking about moving on to Ruby whenever I had a need where Python would be a good choice, but the time it takes for me to understand a new language is blocking me from that.

  • Well, artists would disagree on that point, and I do agree with the artist. I do think ML at this current state and near future do have a limit. I can't see ML doing anything complicated in 3D like a CAD automobile any time soon.

  • Indentations does not really help readability that much in case of really, really, long code, and in some cases, a code can execute without with unexpected result because of one single indentation being off. Both of these why I like things like curly braces/brackets and terminators like endif/fi/done/end/etc. But, at the end of the day, if there's a readability problem, then that's a sign that the code needs to be reworked on.

  • My crazy take is that there needs to be a interpretative language alternative to Python which uses brackets to define scope and/or things like elif/else/fi/endif/done. Much easier that way in my opinion, and the ";" shouldn't be necessary. I'm used to Python, but if I had another language which can be used to serve similar purpose to Python with those features, I would never code in Python again when it comes up.

    Having to code in Julia and G'MIC (Domain-Specific Interpretative language that is arguably the most flexible for raster graphics content creation and editing), they're the closest to there, but they're more suitable for their respective domain than generic ones.

  • Depends. I use G'MIC (Interpretative language for image processing largely inspired by bash) in CLI.

    ig "C:\Users\User.."

    If I need something with '$' in CLI, I'd be using $_path_rc\something_something. Sometimes with "" in case of spaces.

    Other than that, I would be just running my own coded command in most case.

  • What do you mean? I'm pretty new to making syntax highlighting for KDE Kate, so I'm just now fixing my other thing before I get into much more advanced concept of it.

  • So far, the most challenging part was highlighting things that counts as comment rather than pointers to image pixels or accessible variables. That's not the end of my trouble though.

    I do want to figure out how to highlight "expr" including newlines inside expr. expr is basically any mathematical expression that is utilized on JIT compilation.

    • if expr
    • repeat expr
    • variable={expr}
    • variable:=expr <- : can be replaced with operator and it will still apply.
    • eval expr
    • eval "expr"
    • check "expr"
    • fill expr
    • fill "expr"
    • eval>expr
    • eval >"expr"
    • fill >expr
    • fill >"expr"
    • {expr}
    • for expr
    • {"expr"}
    • while expr

    Along with that to set up regex inside it to highlight section of expr.

    While still maintaining priority of regex. So, if one regex is more important, it'll overwrite whatever highlighted.

  • There's no standard regarding G'MIC scripting. That being said, here's a representative G'MIC script - https://pastebin.com/cEPW31HJ .

    The first one is basically a example script for testing syntax highlighting. The second one is a real world case study. The second one can be found in https://github.com/GreycLab/gmic-community/blob/master/include/reptorian.gmic .

    I haven't included some concepts in the example_cli as you can see that reptorian.gmic introduces some concepts not seen in both. Basically, writing a syntax highlighter for G'MIC would be a nightmare. But doable if I can figure things out.

  • Getting highlighting for regex-based selection to work. That seems confusing. I have 7 criterias which is recommended for the G'MIC language.

    Note:

    1. Strings that matches #( |$|(#)+).* gets treated as if it was a comment.
    2. Strings that matches #@cli.* are treated as if they’re a header for CLI codes.
    3. Strings that matches \$(-\d+|\w+|\d+) gets treated as if they’re accessed variables.
    4. Strings that matches \w+: are treated as if they’re commands names.
    5. Any texts under control-flow item list gets highlighted as long as they’re outside any characters between 2 quotation marks and of course, taking into account of / being used as escape character.
    6. #@gui gets bolded.
    7. Anything between 2 quotation marks gets highlighted though escape characters would be considered.

  • I know there's a lot of downvotes because there are people reading this as hate toward Python. On one hand, one can make the case that it is overused and this doesn't bold well for those that simply can never like it's syntax. On the other hand, Python is perfect for small scripts that isn't tailored for a Domain or just quick codes.

  • I actually did that, but it was not satisfactory. And I had hard time making it work like how I want to.

    Maybe I should use a XML editor or something to make it easier. I'll give it another try (I just found the file again). Maybe from scratch even.

    EDIT: To make it clear, I have hard time getting "contexts" working.

  • I'm using G'MIC for raster-graphic image-processing, but I can do other things in it too with ease. I feel this post so much.