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.
 
  • Post
  • Reply
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Dren posted:

Thanks, I'll roll my own. I feel like it's kind of a strange culture on github to not require a license to be specified but to explicitly permit forking. It seems like forking something with no license leaves you in kind of a no-man's land. You were allowed to fork but you're not really allowed to use the code for anything because it's implicitly copyrighted.
You are allowed to build and run it, just not distribute it (in source and binary form).

Requiring a valid open-source license for all projects is pretty much the one thing I like about Google Code.

Adbot
ADBOT LOVES YOU

b0lt
Apr 29, 2005

Internet Janitor posted:

Spotted at work today in C code for an embedded device:

code:
#define MAX_U32 (2^32 - 1) // the largest possible 32 bit unsigned value

original pull request was to change it to 28

Dren
Jan 5, 2001

Pillbug

Plorkyeran posted:

You are allowed to build and run it, just not distribute it (in source and binary form).

Requiring a valid open-source license for all projects is pretty much the one thing I like about Google Code.

Are you? The only rights I see granted in the ToS are the rights to "view and fork" (Section F.1). They never define what "fork" means much less imbue it with any usage rights.

xtal
Jan 9, 2011

by Fluffdaddy

evensevenone posted:

(Not mine)
code:
alias git-yolo='git commit -am "`curl -s [url]http://whatthecommit.com/index.txt[/url]`"'

Abusing alias like that is a horror. Especially because if that was properly in a file called git-yolo, you'd be able to use "git yolo" on the command line!

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Dren posted:

Are you? The only rights I see granted in the ToS are the rights to "view and fork" (Section F.1). They never define what "fork" means much less imbue it with any usage rights.
Barring a hyper-literal definition of "fork" that only lets you click on the fork button and not make local copies of the files on your machine, there's no need to grant usage rights.

dc3k
Feb 18, 2003

what.
Found this in some code the other day and while it isn't the worst thing in the world, it annoyed me because there's no reason to do it and it sort of kills readability.

code:
self.someProperty.booleanProperty = self.someOtherProperty.hidden = self.someOtherPropertyAgain.booleanProperty = self.yetAnotherProperty = self.heyLookSomethingElse = NO;
I tried to explain that it was a dumb thing to do, but he was having none of it. "What's wrong with that? It's fine."


Sacrificing readability to reduce 4 lines of code is dumb.
:(

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Bognar posted:

I've been pushing for code reviews, and we're slowly starting to do them. However, the plan is to introduce them for the more junior developers first and then move up the chain. The guy who writes 'wip' and 'asdf' is our second most senior developer, so it will be a bit before that is fixed by code reviews.

Leading by example, I see.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Bognar posted:

I've been pushing for code reviews, and we're slowly starting to do them. However, the plan is to introduce them for the more junior developers first and then move up the chain. The guy who writes 'wip' and 'asdf' is our second most senior developer, so it will be a bit before that is fixed by code reviews.

What kind of code reviews? Are you talking the meetings where the mess is on the screen and it gets sniped line-by-line, paired stuff, offline reviews, or what?

That person probably thinks they're God's gift to software, so think of all the excuses you can imagine for them to shrug off all the feedback.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

status posted:

Found this in some code the other day and while it isn't the worst thing in the world, it annoyed me because there's no reason to do it and it sort of kills readability.

code:

self.someProperty.booleanProperty = self.someOtherProperty.hidden = self.someOtherPropertyAgain.booleanProperty = self.yetAnotherProperty = self.heyLookSomethingElse = NO;

I tried to explain that it was a dumb thing to do, but he was having none of it. "What's wrong with that? It's fine."

It doesn't work when your properties are WRITE-ONLY!

raminasi
Jan 25, 2005

a last drink with no ice

pokeyman posted:

It doesn't work when your properties are WRITE-ONLY!

Sure it does.

..btt
Mar 26, 2008

status posted:

I tried to explain that it was a dumb thing to do, but he was having none of it. "What's wrong with that? It's fine."


Sacrificing readability to reduce 4 lines of code is dumb.

I do this all the time and don't see a problem with it. What's unclear/unreadable about it? I thought it was a commonly used construct to set a load of variables to the same value.

Crosscontaminant
Jan 18, 2007

It's a gigantic long line when you could increase readability immeasurably at little or no cost by just doing one assignment per line. It violates the Zen of Python in a few different ways, notably "flat is better than nested" and "readability counts".

e: Something else I realised - due to CPython implementation details, if "NO" is a value which isn't precomputed (like an integer between -5 and 128) then the stacked assignment means all those names are given the exact same object, rather than copies of the object.

Python code:
def foo(a, b):
    return a ** b

a = b = foo(8, 5)
a is b # True

c = foo(8, 5)
d = foo(8, 5)
c is d # False

Crosscontaminant fucked around with this message at 08:19 on Aug 15, 2013

..btt
Mar 26, 2008
But he never said it was Python?

Also, you don't seem to explain why it's unclear or unreadable, just restate that it is because it is :confused: I would hope that all most people in the thread understand the transitivity of assignment operators without giving it any thought.

Perhaps I am the horror...

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If you think a line that's 170+ characters long is reasonable in any context then yes perhaps you are the horror.

Crosscontaminant
Jan 18, 2007

..btt posted:

But he never said it was Python?
True. I assume it is on the basis of self.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

GrumpyDoctor posted:

Sure it does.

How could it? Each assignment assigns the value from the RHS into the LHS. Aside from the rightmost assignment, that means getting the value of a property.

raminasi
Jan 25, 2005

a last drink with no ice

pokeyman posted:

How could it? Each assignment assigns the value from the RHS into the LHS. Aside from the rightmost assignment, that means getting the value of a property.

a = b evaluates to "the thing that was stored in a," not "the value of a after the store"

(Disclaimer: I tested this in C#, but as far as I know it's true in any language with C-style assignment semantics.)

raminasi fucked around with this message at 09:25 on Aug 15, 2013

..btt
Mar 26, 2008

Jabor posted:

If you think a line that's 170+ characters long is reasonable in any context then yes perhaps you are the horror.

I was assuming the implied horror was the construct, not the line length. I would stick some line breaks in that specific example.

Zombywuf
Mar 29, 2008

Suspicious Dish posted:

The daemon is nowhere near your init. But what do you have against dbus?

It solves a problem only Gnome developers had, namely that Bonobo was poo poo. And there is really no need for anything like dbus to be anywhere near init, it has nothing to do with the daemon. Emulating a networked message passing system inside your machine in order to boot is nothing but over-engineering.

OzyMandrill
Aug 12, 2013

Look upon my words
and despair

GrumpyDoctor posted:

a = b evaluates to "the thing that was stored in a," not "the value of a after the store"

(Disclaimer: I tested this in C#, but as far as I know it's true in any language with C-style assignment semantics.)

In C++, most operator= overloads I have seen tend to be:
code:
class& class::operator=( const type& )
{
   ...
   return (*this);
}
And if 'type' is different to 'class', then what is passed out must be different to what was passed in.

You would need the extra functions ( like type::operator=(const class&) )to allow the conversion from 'class' back to 'type', and if class was a write-only accessor object, then these probably wouldn't exist.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

..btt posted:

But he never said it was Python?

Also, you don't seem to explain why it's unclear or unreadable, just restate that it is because it is :confused: I would hope that all most people in the thread understand the transitivity of assignment operators without giving it any thought.

Perhaps I am the horror...

You're sacrificing readability for the perceived efficiency of concatenating several lines. As mentioned before, flattening this would make it simpler to parse visually and mentally, as a simple assignment statement is no longer so simple to view. It's in the same area as assigning a variable within an if statement; yes, you can do it, and you'll save a line there too, but it's usually not worth it (although sometimes it can be). I'd let it slide if you were just assigning two variables although I would grump about it, but five is just too long.

Sorry, you're the horror.

Zsa Zsa Gabor
Feb 22, 2006

I don't do drugs, if I want a rush I just get out of the chair when I'm not expecting it
Just got this exception message.

quote:


yo Dave, I'm afraid I can't do that.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Zombywuf posted:

It solves a problem only Gnome developers had, namely that Bonobo was poo poo. And there is really no need for anything like dbus to be anywhere near init, it has nothing to do with the daemon. Emulating a networked message passing system inside your machine in order to boot is nothing but over-engineering.

And as I said, it doesn't. systemd simply uses the serialization protocol between UNIX domain sockets it makes itself so that it didn't have to invent its own. DBus isn't networked either; it runs on UNIX domain sockets and while there have been attempts to change it to remote over TCP, it's been a failure.

..btt
Mar 26, 2008

Volmarias posted:

You're sacrificing readability for the perceived efficiency of concatenating several lines. As mentioned before, flattening this would make it simpler to parse visually and mentally, as a simple assignment statement is no longer so simple to view. It's in the same area as assigning a variable within an if statement; yes, you can do it, and you'll save a line there too, but it's usually not worth it (although sometimes it can be). I'd let it slide if you were just assigning two variables although I would grump about it, but five is just too long.

This'll be my last reply on the subject, since it's starting to become a bit of a derail, but to me it's quicker to mentally parse "set a, b, c and d to x" than it is to parse "set a to x then set b to x then..."

It's not about laziness in typing, it's about the code being more concise and to the point. Happy to accept that I'm unusual in that regard, but it doesn't seem that strange.

Zombywuf
Mar 29, 2008

Suspicious Dish posted:

And as I said, it doesn't. systemd simply uses the serialization protocol between UNIX domain sockets it makes itself so that it didn't have to invent its own. DBus isn't networked either; it runs on UNIX domain sockets and while there have been attempts to change it to remote over TCP, it's been a failure.

I know dbus isn't networked, I said it emulates a network. Dbus is far more than a serialisation format.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

..btt posted:

This'll be my last reply on the subject, since it's starting to become a bit of a derail, but to me it's quicker to mentally parse "set a, b, c and d to x" than it is to parse "set a to x then set b to x then..."

It's more about the shape of the code and your eye's ability to read that shape.

A block like this:

code:
Lorem ipsum dolor sit amet,
Lorem ipsum dolor sit amet,
Lorem ipsum dolor sit amet,
Lorem ipsum dolor sit amet,
is much easier and quicker to grok than a block like this:

code:
Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet,
Your eyes have to travel horizontally across the screen to figure it out rather than a quick vertical scan.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
I thought better of this post

Hammerite fucked around with this message at 15:27 on Aug 15, 2013

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Hammerite posted:

Well, so,

code:
self.someProperty.booleanProperty = self.someOtherProperty.hidden               \
                                  = self.someOtherPropertyAgain.booleanProperty \
                                  = self.yetAnotherProperty                     \
                                  = self.heyLookSomethingElse                   \
                                  = NO
Horror or not? (I say "not" although I don't think I would do it.) Or am I helping to drag us into another ~~coding styles~~ argument?

IMO the more sensible version of that is

code:
self.someProperty.booleanProperty           =
self.someOtherProperty.hidden               =
self.someOtherPropertyAgain.booleanProperty =
self.yetAnotherProperty                     =
self.heyLookSomethingElse                   = NO;
Still not something I would write.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

That Turkey Story posted:

This is true of just about every library, not just logging libraries.

Eh, it's only really true of large libraries that solve problems that on the surface seem like they should be small problems.

dc3k
Feb 18, 2003

what.

Crosscontaminant posted:

True. I assume it is on the basis of self.

Sorry, forgot to mention it's Objective-C.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
My company's coding style specifies tabs instead of spaces, and the rule was set by the senior programmer and I can't change it. I hate my job.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
They sound like smart people, tabs are superior in every way

tef
May 30, 2004

-> some l-system crap ->

Zombywuf posted:

I know dbus isn't networked, I said it emulates a network. Dbus is far more than a serialisation format.

It kinda looks like a linux knock off of 9P/Plan9 :3:

Dren
Jan 5, 2001

Pillbug

Suspicious Dish posted:

My company's coding style specifies tabs instead of spaces, and the rule was set by the senior programmer and I can't change it. I hate my job.

Challenge him to a code review, if you win you take his power.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Suspicious Dish posted:

My company's coding style specifies tabs instead of spaces, and the rule was set by the senior programmer and I can't change it. I hate my job.

Hard NOP Life posted:

They sound like smart people, tabs are superior in every way

Don't loving start.

quiggy
Aug 7, 2010

[in Russian] Oof.


Smart people use whitespace like this. Dumb people use whitespace like this.

That Turkey Story
Mar 30, 2003

Plorkyeran posted:

Eh, it's only really true of large libraries that solve problems that on the surface seem like they should be small problems.

I guess, but on the other hand, when a library is small I often hear a similar but opposite rationale to avoid it, perhaps especially if the problem is seemingly simple:

Why would I use <some small library>? It's simple enough that I can replicate its capabilities with a handful of functions without pulling in a dependency.

Really, in my experience it's just difficult to get people to use a library period. I spend a lot of time bug-fixing or rewriting functions of freely available libraries for projects because people don't want to use them, even if the quality is high and licensing is free of restrictions. The size of a library is often referenced whether large or small.

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

Wheany posted:

Don't loving start.

If I get to define a strict coding style I will mandate the use of U+180E, MONGOLIAN VOWEL SEPARATOR, as the only valid indentation character.

1337JiveTurkey
Feb 17, 2005

That Turkey Story posted:

Really, in my experience it's just difficult to get people to use a library period. I spend a lot of time bug-fixing or rewriting functions of freely available libraries for projects because people don't want to use them, even if the quality is high and licensing is free of restrictions. The size of a library is often referenced whether large or small.

It's just looking for excuses. If the size can't be used to disqualify it, then they'll pick something else. If it's new and unproven, never mind that anything they write instead will inevitably be newer and even less proven. If it's old and clunky, never mind that it's been solving a well-established problem like distributed transaction processing since before they were born while running on computers with less processing power than a toaster. Or it uses a forbidden technology like XML in a way that isn't even apparent to someone using the library. Or it's got too many features. Think about it: How often do you really need to sort any possible permutation of a sequence when some in practice may be impossible to reach? So why use an overkill general sorting algorithm?

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

That Turkey Story posted:

I guess, but on the other hand, when a library is small I often hear a similar but opposite rationale to avoid it, perhaps especially if the problem is seemingly simple:

Why would I use <some small library>? It's simple enough that I can replicate its capabilities with a handful of functions without pulling in a dependency.

Really, in my experience it's just difficult to get people to use a library period. I spend a lot of time bug-fixing or rewriting functions of freely available libraries for projects because people don't want to use them, even if the quality is high and licensing is free of restrictions. The size of a library is often referenced whether large or small.

People are afraid of code they don't understand, and the dialect of a library screws with their own tiny mental model of the universe. I think it goes well beyond libraries.

Now there are some people that have good reason to be afraid of libraries--particularly our friend the DLL. There's nothing quite like program X using core library A not being able to use module Y that also uses core library A. The .NET runtime complains that Y's implementation of interface IFartAllNight is missing an implementation for TootAndPoot(Butts). You look at the source, and you see Y does indeed implement TootAndPoot(Butts). After a day of losing hair, you discover that Y references the core library A from its own path when it was loaded. The DLLs are identical but since they come from different paths, the .NET runtime says they're different.

Then you get into import cascades where loading one library causes a bunch of other ones to start loading from God-knows-where. Then for giggles one of them adds an assembly resolution handler that scans that entire C: drive for a DLL it couldn't find in the default path. You know, why not?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply