I understand this coming from a newcomer but after a while it felt like second-nature to me. I was curious about parent poster, because they said they are using Ruby for years.
How does this make it confusing? What information do you feel () gives you?
You might say:
foo().bar().baz()
Ah well these are clearly method calls, they have ().
But this is Ruby:
foo.bar.baz
These are clearly method calls too, because in Ruby there’s nothing else they could possibly be. The ()s don’t actually disambiguate anything. Unlike C or Java or some other languages with some notion of bare access to internal fields, there are always and only method calls.
I can't fathom optional parenthesis. In this code it makes it very hard to know if today is an attribute or a method without knowing the context, meaning I can't scan the code, I have to read it carefully.
I'm going to emphasize this as well. Everything is an object, and everything called on an object is a method. Full stop.
Unlike with other languages, there is no ambiguity here.
In python, you don't know when you dir() an object whether your dealing with a property or method. In Ruby, you are guaranteed it's always a method. A perk is that you don't need parens.
Exactly. Once you get some basics of Ruby, there is no ambiguity, and I find it quite elegant.
And I think I’m in the minority here, but I prefer the cleanliness of optional punctuation.
That feature also allows for fluent DSLs (which seem to be falling out of favor for various reasons), but is one of the reasons I still love Ruby.
To look at the other side, I hate having to constantly add semicolons and parens in other languages. Makes my poor fingers hurt even more than they usually do.
I think this kind of falls in line with the idea of Ruby giving you sharp knives[0].
Like you I used to have a love / hate relationship with this because it feels inconsistent to sometimes use parenthesis and sometimes not. In a world where you just want to run Python's Black code formatter and always use parenthesis, having to think about when to use parenthesis feels really tedious.
But I think nowadays I'm happy that they are optional because when you want them to be optional it creates a really nice aesthetic to your code.
For example with Rails you can do: `2.days.ago` and then there's also things that feel like a mini DSL such as `validates :title, :body` or `belongs_to :users`. These just look nicer without parenthesis.
With that said, I do use parenthesis more often than not but it's nice to avoid using them when it makes something look nicer visually.
Given the context of this thread (comparison of ruby and python), it should be noted that python also has this. You can decorate a method with `@property` and call the method without parentheses.
It's really nice because it means you don't have to pre-wrap all of your properties with accessor methods. They can just be properties, and if something changes, you swap the property out with a decorated method and you don't need to change any code.
> I can't fathom optional parenthesis. In this code it makes it very hard to know if today is an attribute or a method without knowing the context.
Optional parentheses exist because it is impossible for there to be ambiguity: after a dot, if a name starts with a lowercase letter it is a method (and the reference is a call). If it starts with an upper case letter, it is constant (which is not callable as a method.) There are no other possibilities.
“Attributes” in Ruby are literally just getter methods (possibly paired with setter methods.) There is no object-dot-field access to fields (instance variables exist, but outside access to them doesn't use that syntax, but instead goes through a different set of method calls: Object#instance_variable-(get/set)
Makes reading ruby so much more difficult. Also optional return statements. If you need to refactor a function, it’s not always obvious that it’s relying on an implicit return and super easy to break things IMO
(not trying to convince you as I think in this thread no one will be convinced of anything)
Knowing that in Ruby a method will always return its last executed line unless explicitly returned early makes (at least for me) things very easy to get.
A method with two branches will always return the last line of the executed branch, thus you will always know what the response could be.
But this (IMO) is because Ruby OOP where the main concept is that when you are invoking a method you are actually sending a message to that object thus you should get a response. So Ruby makes this way of working with objects universal.
Once you call a method you will get a response.
I find it strange the other way around, working in languages where I need to put return even on the last line of the method. For example after almost one year of full time backend development in Ruby, I needed to write some JS code. I debugged for half an hour why a short function that I wrote was not working properly until I got it: I need to add 'return' to that last line to get the actual result. This was strange for me :)
In case you want (and need) to get how to think in Ruby I recommend you to listen to this talk by Sandi Metz (and in general I recommend all her talks even if they are old): https://www.youtube.com/watch?v=XXi_FBrZQiU
It presents OOP in Ruby in such a beautiful way and it takes a while to start thinking like this.
There may be other things about Ruby that I disagree with, but this is probably my primary disagreement.
It does make code more difficult to understand for exactly the reason you mentioned, and furthermore it can sometimes be disallowed based on the rest of the expression (such that parens are required).
In my own Ruby code, I often use parens when they are optional.
Almost any software project from Google with some kind of user-facing API seems to fail, because Google somehow sucks at API design. Like how awful to use Tensorflow became, leading to it getting largely replaced by PyTorch. Or how complex and convoluted AngularJS was, compared to ReactJS which replaced it. Google's design philosophy seems to be the polar opposite of Linux's "Don't break userspace", so I can see why application developers wouldn't trust a kernel written by them.
Dart itself is another example: it started similar to Typescript, but Typescript quickly grew to surpass it in every way. Because Typescript eagerly learned from modern programming language theory, while Dart stuck to Google's "try to make everything like 1990s OO" approach.
It's the same with feminism, pacifism, communism, veganism, etc.
I have around me numerous activists about various topics I'm not invested in: feminists, communists and vegans, mostly. Most of them don't try to guilt trip me or convince me of anything. They just do their stuff.
Once in a while, one of them do, just like once in a while, a doctor makes a medical error or a plane crashes.
But we tend to only remember this one, and associate the movement with it.
AWS S3 does the opposite when querying objects that don't exist. If you don't have s3:ListObjects permissions on the bucket you'll get a 403 error (you can't differentiate between the object not existing vs. you don't have access to it).
I think either approach is valid as long as you're consistent. You can make a case for either 404 or 403 when you don't have enough permissions. In GitHub's case you can argue that it's a 404 because the resource does indeed not exist through your auth context. In AWS' case you can argue that a 403 makes sense because you don't have permission to know the answer to your query.
2FA is a pain in the ass and provides minimal extra security. The reason why companies employ it is because their users are incompetent and will install malware on their desktop OS, so they shift the burden of security to locked-down mobile operating systems like Android and iOS.
If an experienced user does not want to use 2FA, they will run the 2FA app in a virtual machine and automate it. You can't force them to 2FA but you can inconvenience them and tie them down to a phone number, SMS, or locked-down hardware (through remote attestation).
>Letsencrypt was a boon to the web.
Letsencrypt and the existing PKI structure just forces everyone's eggs into a single basket, Ripe for exploitation from the government.
And here is where Django and RoR shine. With their very rich, and above all, well integrated ecosystem, we have had plugins to do all this with a few settings for years.
That's where "libs over frameworks" doesn't pay.
And you don't have to delegate your sign in to a third party, share user data, get locked in, or have all the problems associated with having some part of your stack as a service, micro or not.
8ft is 2.4m, it's not that long, it's the lenght of a small car. With current modern resolutions and zooms, you can even read the name of cops on their plaque from that distance.
I don't think it's going to prevent much recording. In fact, the recording are probably be of much more quality: instead of close ups that doesn't show much actions, we will see the a bigger context. Most useful videos are from at least 8 ft away.
I understand the author of the law doesn't have a great background in the US and cops have terrible reputation in this country. So it's probable there is an abuse path I don't see here.
But if I haven't been given that context, the law would not have seen excessive: in a law enforcement context, you don't want every body to park too close to the hot spot. Also, there is this annoying tendency of people with a camera to put it in your face, or to not mind their surrounding.
Given an arrest can be tensed, 8ft sound like it make sense. What am I missing, as a French person not understanding all the weird american social details ?
It's not so much the specific distance as the limitation and illegal "zone" that now exists around officers, a moving target for when you can suddenly ve performing something illegal that wasn't illegal a few centimeters ago. A cop leaning a bit or just shifting their weight is enough to make you a criminal.
The main reason there is such concern over this is because the power and corruption in many police forces and a lack of accountability for misbehavior of police, combined with the silliness of such a concept of no recording zone that now surrounds officers.
The issue isn't about how practical it is to record a police officer, it's that rather than address institutional corruption and misbehavior, there is a very vague law with ridiculous premises invented that gives police the ability to issue fines and arrests. Proof of misbehavior can be confiscated by a sudden movement by any police officer. It's a very strange power to give police officers.
If you are able to position yourself at a safe distance down to the centimeter, you probably also have the super power to move when the officer shifts weight.
The easy solution is to post up at 15 feet and vigilantly adapt. If you are filming an intense arrest, I would hope you would maintain that sort of situational awareness anyway.
I certainly understand your concerns about abuse of power. However, giving officers room to do their job is not “very strange” nor is the premise “ridiculous.” Indeed, moving bystanders back to a reasonable distance might reduce tension and the likelihood of misbehavior
I appreciate what I assume is a good faith attempt to read this law, but the law isn't about giving the officers room to safely operate. If that were the case, it would not cite _recording the officers_ as the illegal action, it would just define a minimum perimeter of non-interference.
> However, giving officers room to do their job is not “very strange” nor is the premise “ridiculous.” Indeed, moving bystanders back to a reasonable distance might reduce tension and the likelihood of misbehavior
As the law is written and the language of the law specifically acting on _making a video recording_, and nothing else:
IT IS UNLAWFUL FOR A PERSON TO KNOWINGLY MAKE A VIDEO RECORDING
7 OF LAW ENFORCEMENT ACTIVITY IF THE PERSON MAKING THE VIDEO RECORDING IS
8 WITHIN EIGHT FEET OF WHERE THE PERSON KNOWS OR REASONABLY SHOULD KNOW THAT
9 LAW ENFORCEMENT ACTIVITY IS OCCURRING,
If this was about officer safety to operate, then it would just define it as such, but it goes out of its way to specifically forbid recording.
So I can do the following actions which are certainly disruptive to the police making an arrest without violating this law:
- Stop for a smoke next to an officer (presuming I am in one of the allowed places for smoking)
- Make out with someone in a publicly respectable way
- Busking of any kind
- Rollerskate/Skateboard as long as I am practicing reasonable safety
I think it's not easily contestable that these actions are _more_ disruptive to the police being engaged in an arrest, but the law has no concern about them as the focus of the law is exclusively recording. Other laws regarding arrests don't mention such a distance or rights for the officers. The point here is not some desire to interfere with arrests, it's that the premise of your statement that it's about officer safety and ability to perform doesn't pass scrutiny against the text of the law and other situations that would fall under the same concern, which are allowed.
I don't see a justification for this law except to allow police the right to fine/jail people recording them.
Edit: It may be suggested that laws should be concise and specific, and to a point I agree. However, such conciseness also means that the specific action meant to be prevented is much more clear. So I must stress, that even if the law is concise, this means that the focus is not on safety for police and bystanders, but specifically on recording the police. I'm not sure there is a logical interpretation any other way to suggest it's about safety to operate, because if it is, then the law is no longer concise and specific, it requires fairly roundabout inference to reach the spirit of the law.
Once you are being arrested, you are no longer a bystander, so you may continue filming.
I understand your fear of the chilling effect this may have, but I would guess there will be just as many people who now feel empowered to say “This is my right. I’m 8 ft away.”
> B. NOTWITHSTANDING SUBSECTION A OF THIS SECTION, A PERSON WHO IS
22 THE SUBJECT OF POLICE CONTACT MAY RECORD THE ENCOUNTER IF THE PERSON IS
23 NOT INTERFERING WITH LAWFUL POLICE ACTIONS,
The basis of being subject to this law is that you are interfering with police actions, and lawfulness can only be determined by the courts after the fact.
I don't think it's a foregone conclusion that you would be in your legal right to record the police if you were being arrested for violation of this law, and likely it's something that would need to be tested fairly considerably in court before a definite interpretation was set.
This is a really badly designed/defined law, and I would not rely on the guarantees of the law as being subject to it means it's already been determined you're interfering with police action.
Except that isn't what it is for. It's so when someone is being lawfully detained, you don't get 30 people circling the officer(s) shouting things and exciting one another, while recording and blocking view and the movement of officers.
It's purely a safety thing. You don't want random people close to you while you are dealing with something
- https://www.youtube.com/watch?v=Sw3F91w6D78 here is a video of onlookers recording agitating one another, several of which are standing in the street and blocking police vehicles.
- https://www.youtube.com/watch?v=71wdrhKzuys here a man that had been harassing local businesses and patrons all day charges a guardsman (who's an off-duty police officer) and the crowd starts surrounding him, recording, shouting things, agitating, when another bystander jumps to the guardsman's defense and now you've got multiple hostile people getting more and more agitated while the guardsman waits for uniformed police to come take the guy that tried to assault him, tried to damage his car, was harassing others, etc.
- https://www.youtube.com/watch?v=H40vEOOs5z0 here are protestors, standing around filming each other, assaulting a motorcycle officer on his motorcycle as he tries to drive away from them
- https://www.youtube.com/watch?v=gvDwWSl-sVE here officers try to restrain a felon, in felony possession of a firearm, that had tried to assault officers while a felon unlawfully possessing a firearm, as people surrounded them to hold their phones as close to them as possible to take footage, then as 3 of them try to subdue the suspect that continued, while armed, to try and resist then has to escalate to non-lethal violence of gasp punching the guy to try to get him to submit. At 3:42 an onlooker throws a full trash can at the officers that are actively trying to handcuff an ARMED FELON that is fighting tooth and nail to escape.
- https://www.youtube.com/watch?v=sdFsumyHLXo guy on a roof of a business hops down, then retrieves a handgun and aims it at officers, the officers start issuing commands while a bystander walks into the officer's line of fire filming and occasionally shouting things (go to 4:20 and you can see them just right of 12 o'clock.)
Etc.
It's hard enough to deal with a life or death situation without an angry mob of people standing around shouting shoving their phone in your face.
You've got a lot of videos of people messing with cops. In any of them, did the fact that someone was recording, as opposed to any other crimes they may have committed, make the officers' job harder?
This law is much, much more about removing accountability than police safety.
I think the law excludes the restriction when filming in a confined structure. I don’t know if a car qualifies, but as the intention is to prevent interference, it arguably could qualify.