SDF Chatter
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
danhab99@programming.dev to TypeScript@programming.dev · 2 years ago

Typescript is implementing a using keyword

www.totaltypescript.com

external-link
message-square
5
link
fedilink
  • cross-posted to:
  • tech@kbin.social
  • technews@radiation.party
20
external-link

Typescript is implementing a using keyword

www.totaltypescript.com

danhab99@programming.dev to TypeScript@programming.dev · 2 years ago
message-square
5
link
fedilink
  • cross-posted to:
  • tech@kbin.social
  • technews@radiation.party
TypeScript 5.2's New Keyword: 'using'
www.totaltypescript.com
external-link
TypeScript 5.2 introduces 'using', a keyword that disposes anything with a `Symbol.dispose` function upon leaving scope, making resource management easier.
alert-triangle
You must log in or register to comment.
  • cwagner@lemmy.cwagner.me
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    2 years ago

    deleted by creator

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

      Discriminated unions have been In The Works™ for quite a while. I believe they were cut from the C# 12 roadmap. But maybe C# 13?

      I think a source-generation based approach similar to OneOf isn’t unlikely.

      • Lmaydev@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Yeah unfortunately tacking them onto a 20 year old language is not easy.

        It’s great to see it being worked on but there is a long way to go.

  • yads@lemmy.ca
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

    That seems quite useful

  • nickel@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    Does using function as a const? Meaning: when a using variable is declared, is it immutable?

    • burkybang@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      This comment sounds like you’re having a stroke if we didn’t know the context.

TypeScript@programming.dev

typescript@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: !typescript@programming.dev
Visibility: Public
globe

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

  • 1 user / day
  • 6 users / week
  • 12 users / month
  • 104 users / 6 months
  • 6 local subscribers
  • 998 subscribers
  • 66 Posts
  • 81 Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Thomas@lemmy.douwes.co.uk
  • Ategon@programming.dev
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org