Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What's a "real" programming language?

What's a "real" programming language?

Scheduled Pinned Locked Moved The Lounge
javascriptcsharptutorialc++com
85 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H honey the codewitch

    Bear with me, because as much as I am loath to holy roll about technology, I still have my peeves. I went about porting my DFA lexer engine from C# to TypeScript. It was primarily an exercise in teaching myself TypeScript, plus brushing up on my JS. So I implement the bones of it, and after adjusting my mental map to the JS way of doing things I got it mostly working. Then I went about trying to use a Map keyed by Sets. Turns out JS Map and Set will only compare by value for "scalar" types (presumably including strings) or otherwise it uses reference comparisons. You can't override your own equality mechanism either. how to customize object equality for javascript set - Stack Overflow[^] Consequently, there is no performant way to do subset construction to convert an NFA to a DFA in this language. I've seen others solve this problem by using string keys, but this falls down for machines of non-trivial size. Regex FA visualizer[^] is one example but I can basically crash it or stall it out for a long time at least with any non-trivial expression. This one also doesn't work properly besides, but I have no other link handy for you to try. This may be academic, but it is also basic computer science. A language should be able to allow you to implement computer sciencey algorithms and constructs - especially those that have been adapted to countless other programming languages. DFA by subset construction is basic. And you can't do it in JS. I can't even begin to imagine what LALR table generation would look like. You may be wondering why do I care? Because node.js. Because Angular Because React-Native it's not just for web front ends anymore. JS is an almost virulent technology these days. It needs to be, if not Turing complete at least cover the fundamentals, or you're just spreading garbage around. Without a way to do custom comparisons at the very least on hashed containers, your language isn't going to be able to do a lot of things other high level languages can accomplish handily. Is it even a "real" language? Is it ready for primetime, or is it just being adopted because we can? :~

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #81

    I read your message in the daily insider and kept it for after my vacation. I'm still on vacation, but I'm at my computer for a moment. Way too long ago (2016-2017), I wrote a LINQ library in JavaScript. The one thing I really couldn't copy was the dictionary because of a lack of hashes. Here's how I worked around it (it's not a true dictionary anymore, but as far as usage go it's the same as C#): Arrgh.js - Bringing LINQ to JavaScript[^] Probably not very useful for your use case, but you might find it interesting.

    Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

    1 Reply Last reply
    0
    • H honey the codewitch

      TypeScript (JS really in this case, since TS is just syntactic sugar and validation) doesn't imply a web app anymore, which was part of the point I was making in my original, arguably too verbose post. It's used on the backend (node.js). It's used on the desktop (angular, react-native). Kevin only knows where next? My concern is it doesn't seem ready for it. As far as computer sciencey algorithms not being needed, consider that constructs in computer science make up nearly every programming problem you'll ever solve. DFA by subset construction is not the only place you'd ever need custom equality. From ECMAScript 6: maps and sets[^]

      5.2 Why can’t I configure how maps and sets compare keys and values? Question: It would be nice if there were a way to configure what map keys and what set elements are considered equal. Why isn’t there? Answer: That feature has been postponed, as it is difficult to implement properly and efficiently. One option is to hand callbacks to collections that specify equality. Another option, available in Java, is to specify equality via a method that object implement (equals() in Java). However, this approach is problematic for mutable objects: In general, if an object changes, its “location” inside a collection has to change, as well. But that’s not what happens in Java. JavaScript will probably go the safer route of only enabling comparison by value for special immutable objects (so-called value objects). Comparison by value means that two values are considered equal if their contents are equal. Primitive values are compared by value in JavaScript.

      Read that carefully and you'll see the problem is more fundamental than simply maps and sets. You can't override equality. You can't implement custom value equality for objects. That hamstrings your ability to use Sets and Maps in the first place, but that's not the only place it limits you. It also speaks to a large issue of - if this is missing/incomplete/problematic-to-implement based on how the language works under the covers, what else can't it do that is fundamental?

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      H Offline
      H Offline
      hpcoder2
      wrote on last edited by
      #82

      Big one for me - lack of destructors or finalisers.

      H 1 Reply Last reply
      0
      • H hpcoder2

        Big one for me - lack of destructors or finalisers.

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #83

        I've gotten so used to garbage collection that I've learned to accept it. I don't like it but it's no longer a huge deal for me.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        H 1 Reply Last reply
        0
        • H honey the codewitch

          I've gotten so used to garbage collection that I've learned to accept it. I don't like it but it's no longer a huge deal for me.

          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

          H Offline
          H Offline
          hpcoder2
          wrote on last edited by
          #84

          It's not a matter of garbage collection. Java, C# and even Python have finalisers that support adding code that is executed when an object is reaped by the GC. This becomes essential when providing a C++ implementation of an object in the target language (say via Emscripten) to arrange for the C++ destructor to be called when the owning object is destroyed by the garbage collector. Lack of finalisers mean the C++ implementation is limited to PODs (plain ordinary data types), whcih is pretty damn limiting.

          H 1 Reply Last reply
          0
          • H hpcoder2

            It's not a matter of garbage collection. Java, C# and even Python have finalisers that support adding code that is executed when an object is reaped by the GC. This becomes essential when providing a C++ implementation of an object in the target language (say via Emscripten) to arrange for the C++ destructor to be called when the owning object is destroyed by the garbage collector. Lack of finalisers mean the C++ implementation is limited to PODs (plain ordinary data types), whcih is pretty damn limiting.

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #85

            That's fair enough. I didn't realize that limitation of emscripten.

            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups