Lemmy.World
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
qaz to Programmer Humor@programming.devEnglish · 1 year ago

When you manage to break the type system

message-square
12
link
fedilink
108

When you manage to break the type system

qaz to Programmer Humor@programming.devEnglish · 1 year ago
message-square
12
link
fedilink
alert-triangle
You must log in or # to comment.
  • henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    17
    ·
    edit-2
    1 year ago

    I mean, the type system isn’t very strict at all to begin with in some . It’s trivially breakable when performing common operations like type punning in C.

    • Korne127
      link
      fedilink
      arrow-up
      13
      ·
      1 year ago

      Depends on the programming language

    • GetOffMyLan@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      That’s why we don’t like c

  • onlinepersona@programming.dev
    link
    fedilink
    arrow-up
    11
    arrow-down
    2
    ·
    1 year ago

    What did you actually do?

    Anti Commercial-AI license

    • qazOP
      link
      fedilink
      English
      arrow-up
      23
      ·
      1 year ago

      I broke the type system in Kotlin and ended up with a null value in a non-null (not lateinit) variable.

      • Nat (she/they)@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        6
        ·
        1 year ago

        How convoluted was it?

      • MMauro@feddit.it
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        With no platform types involved?

        • qazOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Yes

          • MMauro@feddit.it
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            Interesting. Care to share? I think they fixed a few of those issues with K2. Did you find something new or is it known?

            • qazOP
              link
              fedilink
              English
              arrow-up
              3
              ·
              edit-2
              1 year ago

              It was about 3 years ago, and I haven’t been able to find my old code again. I probably discarded it after finding out it didn’t work well. I was able to find this screenshot though:

              • MMauro@feddit.it
                link
                fedilink
                arrow-up
                3
                ·
                1 year ago

                Uh. Probably not exactly your case, but I managed to “reproduce” them.

                The first case is easy if you just override the setter of a property, and is more a feature of the language rather than a bug.

                The second case is more tricky, but by using a generic delegate you can manage to trick it by doing an unchecked cast. Got the same warning in IntelliJ as well.

                Link: https://pl.kotl.in/pIt-uHw7d

  • kryllic@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Heinz Doofenshmirtz as senior dev

Programmer Humor@programming.dev

programmer_humor@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: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 2.46K users / day
  • 5.08K users / week
  • 8.56K users / month
  • 19.1K users / 6 months
  • 8.13K local subscribers
  • 27.3K subscribers
  • 1.9K Posts
  • 70.4K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • UI: 0.19.12-3-gc6677485
  • BE: 0.19.12-4-gd8445881a
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org