Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Putting 'final' on a method parameter is equivalent to putting it on a local variable inside the method - it doesn't actually mean anything at all to code that calls the method.

Everything in Java is passed by value. If you reassign a parameter to be something else (which is the only thing that declaring it final prevents you from doing), that has zero effect on anything outside the method.

Adbot
ADBOT LOVES YOU

Sauer
Sep 13, 2005

Socialize Everything!
atom.io, because why shouldn't you load an entire webkit environment to edit text? there needs to be people who's job it is to hunt down web developers who manage to escape from the browser

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Sauer posted:

atom.io, because why shouldn't you load an entire webkit environment to edit text? there needs to be people who's job it is to hunt down web developers who manage to escape from the browser

w3school of assassins

Soricidus
Oct 21, 2010
freedom-hating statist shill

CPColin posted:

In Java 8, you don't need the "final" modifier, if nothing in your method tries to change the value. "Effectively final" values can be used in inner classes and closures.

oh neat

i look forward to eventually being able to use java 8. i've nearly managed to persuade all my users to upgrade from java 6 so it might happen within the next decade.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

bobbilljim posted:

w3school of assassins

The Dart Brotherhood

Notorious b.s.d.
Jan 25, 2003

by Reene

Soricidus posted:

so instead of having an insecure unpatched libxml2 that you don't know about that some module built from source, you have an insecure unpatched libxml2 that you don't know about that some module bundled as a binary?

you have a hard dep on a specific version of a system library, and you distribute a pre-compiled FFI binding.

Soricidus posted:

also we have to live in the real world, where a lot of python runs on linux and distributing binaries for linux is painful to say the least

java manages it

Notorious b.s.d.
Jan 25, 2003

by Reene

eschaton posted:

ref counting is a form of garbage collection

i disagree

Notorious b.s.d.
Jan 25, 2003

by Reene

Symbolic Butt posted:

it's true, this is all bad but I don't get your beef with reference counting. are you like a mark and sweep kind of dude?

mark and sweep is babby's first garbage collector. it is the naive approach, the simplest thing that could possibly work.

ref counting isn't even that. it's less than the trivial attempt. it's a five year old shoving poo poo under the bed and saying he cleaned his room

Jerry Bindle
May 16, 2003

http://www.catb.org/jargon/html/koans.html posted:

One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.”

Moon patiently told the student the following story:

“One day a student came to Moon and said: ‘I understand how to make a better garbage collector...

Stringent
Dec 22, 2004


image text goes here

lol

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Ludwig van Halen posted:

whats even the point of using final or const

if you don't want a variable to change then just don't change it dummies

It's important when you don't want other code to mutate you state, but not providing mutators in the first place effectively gives you that.

more like dICK
Feb 15, 2010

This is inevitable.
python has precompiled dependencies in the form of wheels, and the garbage collector does cycle detection

Brain Candy
May 18, 2006

Ludwig van Halen posted:

whats even the point of using final or const

if you don't want a variable to change then just don't change it dummies

as just discussed, there's no good reason to use final on local vars as of java 8

but:

when you use final on fields, you can make them visible to child classes via the protected keyword without letting them be reseated
when you don't initialize final fields you get a compiler error
final on methods means nobody can override the method
final on classes means nobody can inherit from that class

and so nobody can reassign static constants

its all about specifying what other people can do to your code

const is for the same reason, and has similar uses with fields & inheritance and globals*

but primarily, you pass out const things to avoid needing to defensively copy every time somebody wants to look at some data. if the compiler didn't enforce it, you'd get
code:
void notouching(const Butt& butt)
{
    stillokay(butt);
}

void stillokay(const Butt& butt)
{
   whoops(butt);
}

void whoops(Butt& butt)
{
    butt.mutate();
}
*which frequently decays to no copying because lol, static initialization fiasco

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
for me a good reason to use final is so i dont have to think as hard

CPColin
Sep 9, 2003

Big ol' smile.
Speaking of not thinking hard, QA caught this in my code today:

code:
public int getCountryId()
{
   return getCountryId();
}
:downs:

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
lmao nice job

Space Whale
Nov 6, 2014

CPColin posted:

Speaking of not thinking hard, QA caught this in my code today:

code:
public int getCountryId()
{
   return getCountryId();
}
:downs:

How did the compiler not scream at you?

I mean that's just a stack overflow waiting to happen but wouldn't the compiler just glare at you and ask where the implementation was?

leftist heap
Feb 28, 2013

Fun Shoe
sometimes blowing the stack is the desired behavior

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
maybe we should ask about it on stackoverflow.com

qntm
Jun 17, 2009

Space Whale posted:

How did the compiler not scream at you?

I mean that's just a stack overflow waiting to happen but wouldn't the compiler just glare at you and ask where the implementation was?

the implementation's right there, silly

bobbilljim posted:

maybe we should ask about it on stackoverflow.com

lol

Soricidus
Oct 21, 2010
freedom-hating statist shill
this is why you need tail call elimination, gets rid of those nasty stack overflows and lets your code work as written

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD
R# gives you a nice little ⟳ icon next to such functions

Baxate
Feb 1, 2011

Space Whale posted:

How did the compiler not scream at you?

I mean that's just a stack overflow waiting to happen but wouldn't the compiler just glare at you and ask where the implementation was?

recursion is a valid technique

brap
Aug 23, 2004

Grimey Drawer
yeah and maybe the compiler should be able to notice when there's no base case and warn you

Bloody
Mar 3, 2013

Ludwig van Halen posted:

recursion is a valid technique

lol no it isnt

jony neuemonic
Nov 13, 2009

Bloody posted:

lol no it isnt

i don't know about this one bloody, i think you might be incorrect.

Bloody
Mar 3, 2013

nope. recursion is dumb, bad, and useless. it's a way for people to feel clever while writing loops, and cleverness is always bad.

triple sulk
Sep 17, 2014



tail recursion is cool and good

leftist heap
Feb 28, 2013

Fun Shoe
recursion is a good way to describe some algorithms abstractly




which should then be implemented as loops

Baxate
Feb 1, 2011

an infinite loop could never happen

MononcQc
May 29, 2007

A fsm is a good example of a thing that can use recursion and tail call elimination

oh no blimp issue
Feb 23, 2011

recursion is good and fun if you really like massive stacks

i had to write a recursive write/sorted print for a binary tree in an interview once, that was fun

brap
Aug 23, 2004

Grimey Drawer
recursion is a good technique for describing some algorithms. using it in production code without TCO or something seems pretty dumb though

jony neuemonic
Nov 13, 2009

Awia posted:

recursion is good and fun if you really like massive stacks

i had to write a recursive write/sorted print for a binary tree in an interview once, that was fun

i like big stacks, and i can not lie.

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
heh, yeah, lemme just traverse this graph iteratively

Jerry Bindle
May 16, 2003

fleshweasel posted:

recursion is a good technique for describing some algorithms. using it in production code without TCO or something seems pretty dumb though

i agree with this poster

what languages besides scheme require TCO? i would like to know about them and jerk off to recursive algorithms in new and exciting languages

oh no blimp issue
Feb 23, 2011

using recursion looks cool and good, right up to the point a colleague punches you

Arcsech
Aug 5, 2008

Barnyard Protein posted:

i agree with this poster

what languages besides scheme require TCO? i would like to know about them and jerk off to recursive algorithms in new and exciting languages

if you want to jerk off to recursion, use haskell, the ultimate jerking-off language

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
my entirely bespoke custom crystal web framework/docker frontend is coming along nicely. it can attach or even unattach from multiple containers stderr/out/logs!!!!!

Adbot
ADBOT LOVES YOU

leftist heap
Feb 28, 2013

Fun Shoe

Arcsech posted:

if you want to jerk off to recursion, use haskell, the ultimate jerking-off language

  • Locked thread