You are viewing a single thread.
View all comments View context
5 points

Recently I encountered an issue with “casting”. I had a class “foo” and a class “bar” that extended class foo. I made a list of class “foo” and added “bar” objects to the list. But when I tried use objects from “foo” list and cast them to bar and attempted to use a “bar” member function I got a runtime error saying it didn’t exists maybe this was user error but it doesn’t align with what I come to expect from languages.

I just feel like instead of slapping some silly abstraction on a language we should actually work on integrating a proper type safe language in its stead.

permalink
report
parent
reply
2 points
*

I think that might be user error as I can’t recreate that:

permalink
report
parent
reply
2 points

Yeah, you would get a runtime error calling that member without checking that it exists.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 4.3K

    Monthly active users

  • 943

    Posts

  • 10K

    Comments

Community moderators