Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
Mac ( mac@programming.dev )  to Programming@programming.dev · 3 years ago

Strings do too many things

buttondown.email

external-link
message-square
11
link
fedilink
69
external-link

Strings do too many things

buttondown.email

Mac ( mac@programming.dev )  to Programming@programming.dev · 3 years ago
message-square
11
link
fedilink
The most powerful and terrible of all basis types
alert-triangle
You must log in or # to comment.
  • darkmatternoodlecow ( darkmatternoodlecow@programming.dev ) 
    link
    fedilink
    arrow-up
    27
    ·
    edit-2
    3 years ago

    deleted by creator

    • andrew ( andrew@lemmy.stuart.fun ) 
      link
      fedilink
      English
      arrow-up
      22
      ·
      3 years ago

      Wait till you hear what strings are under the hood. Integers in a trench coat!

      • darkmatternoodlecow ( darkmatternoodlecow@programming.dev ) 
        link
        fedilink
        arrow-up
        16
        ·
        edit-2
        3 years ago

        deleted by creator

    • tias ( tias@discuss.tchncs.de ) 
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      3 years ago

      I think the article makes a good point, but perhaps I’m over-interpreting. It’s not that we should stop using strings. It’s that we should use the type system to separate different kinds of strings and enlist the compiler’s help to detect incorrect mingling of them. So for example a symbol type would only permit strings that contain ASCII letters, underscore and digits, and concatenation with / conversion to plain strings would be limited.

    • dudinax ( dudinax@programming.dev ) 
      link
      fedilink
      arrow-up
      1
      ·
      3 years ago

      What’s the meaning of a fractional “Degree of Kevin Bacon”?

      • Kogasa ( kogasa@programming.dev ) 
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        The analytic continuation of KB(x) to the complex plane subject to a superconvexivity constraint is unique but doesn’t necessarily have a straightforward geometric interpretation

    • corytheboyd ( corytheboyd@kbin.social ) 
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      3 years ago

      You joke, but Rails actually does make Integer do too many things lol. I’d argue they’re useful things, but it does so by patching the core Ruby Integer class :p

  • thingsiplay ( thingsiplay@beehaw.org ) 
    link
    fedilink
    arrow-up
    13
    ·
    3 years ago

    Sounds like skill issues and depends on the context. Is this article about JavaScript? I recommend trying out Rust. Strings do only too many things, if you do it. Create your own types and enums. An example missing in the article are file or url paths. Use the standard libraries and types that are given to you.

  • vzq ( vzq@lemmy.blahaj.zone ) 
    link
    fedilink
    arrow-up
    13
    ·
    3 years ago

    As a physicist, I agree ;)

  • corytheboyd ( corytheboyd@kbin.social ) 
    link
    fedilink
    arrow-up
    12
    ·
    3 years ago

    Strings became ubiquitously used for a reason, they map really clearly to the way we think as humans. Most importantly, when you’re debugging, seeing string data is much friendlier than whatever data your symbols map to (usually integers, from enum structures)

    No, obviously it’s not the most efficient thing in the world, but it hardly matters, and you’re not getting anyone to stop because you’re “technically right”.

  • state_electrician ( state_electrician@discuss.tchncs.de ) 
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    3 years ago

    Man, stop overthinking stuff.

  • Venator ( Venator@lemmy.nz ) 
    link
    fedilink
    arrow-up
    4
    ·
    3 years ago

    Unless you’re using assembly, strings do everything, since the code files are also strings.

  • demesisx ( demesisx@infosec.pub ) 
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    3 years ago

    …and that’s why it is wise to use monadic parsers at the input boundary.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 103 users / day
  • 413 users / week
  • 1.67K users / month
  • 4.15K users / 6 months
  • 449 local subscribers
  • 28.7K subscribers
  • 2.93K Posts
  • 22.9K Comments
  • Modlog
  • mods:
  • snowe ( snowe@programming.dev ) 
  • Ategon ( Ategon@programming.dev ) 
  • UlrikHD ( UlrikHD@programming.dev ) 
  • bugsmith ( bugsmith@programming.dev ) 
  • Spyro ( Spyro@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code