Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pass by reference / pass by value is so syntactically batshit insane in Java that it shouldn't even be considered as an intro language option.

And before someone points out that, actually-technically, Java is always pass by value, I will pre-retort that reference-as-value isn't an argument we should ever be having about an intro programming language.

Either teach a systems language with unambiguous pointers, or teach something that abstracts consistently.



The only problem here is using the term "reference" for reference variables. If you would say "these are pointers to objects, but you can't actually do any pointer arithmetic", this would be a non-issue. The pass by value is not the problem here.


C and Pascal and even C++ have a very simple model. An address of a variable is a pointer. You can actually understand how memory is layed out on hardware and why you would want to pass references or pointers instead of copying very large data structures.


I'd sum up my feelings on intro Java as requiring too many "except when..."s.

I understand why (now), but at the time, it just added unnecessary cognitive load on top of already learning hardware models.

C and Pascal require fewer exceptions, despite a larger base knowledge requirement.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: