Hacker Newsnew | past | comments | ask | show | jobs | submit | more zaphirplane's commentslogin

Crap I always thought individual is a singular.


So many options why oh why. let run with also apply


Each does different things, and Rust also has plenty of them. and_then(), or(), or_else(), then(), the list goes on. Kotlin just implements them more widely.

Actually, Kotlin's with() and apply() are more powerful than what Rust can provide. Then again, Rust isn't designed with OO in mind, so you probably shouldn't use those patterns in Rust anyway.


Surely you have to appreciate or else are a different from then examples I gave, the 6 or so kotlin are effectively call a closure with a captured object, with some variation on the return value


I think you've misunderstood the point they were making by addressing the number as if it was the only concern and then only mentioning the actual point they were trying to make as if it were an incidental afterthought. I don't think it's likely they're criticizing five functions in the standard library is too many, but that having five special functions with certain semantics that only apply to them is too many. The methods you mention in Rust are all in the first category; you could easily write them yourself for any type you define without needing to resort to wrapping any of them. It's not clear to me that someone could write a function in Kotlin with special scoping semantics around an object without resorting to wrapping one of those functions.


The Kotlin functions are actually quite easy to write, they're all written in standard Kotlin.

also: https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std...

apply: https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std...

let: https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std...

with: https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std...

run (two overloads): https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std... and https://github.com/JetBrains/kotlin/blob/2.3.0/libraries/std...

These all heavily rely on Kotlin's ability to write an extension function for any class. When you write `with(x) { something() }` you're extending the type of `x` (be that int, List<String>, or SomeObject) with an anonymous method, and passing that as a second parameter.

Consider the signature here:

    public inline fun <T, R> with(receiver: T, block: T.() -> R): R
The first object is a generic object T, which can be anything. The second is a member function of T that returns R, which again can be just about anything, as long as it operates on T and returns R.

Let does it kind of diferently:

    public inline fun <T, R> T.let(block: (T) -> R): R
This is an extension method that applies to every single class as T isn't restricted, so as long as this function is in scope (it's in the standard library so it will be), every single object will have a let() method. The only parameter, block, is a lambda that takes T and returns R.

So for instance:

   val x = makeFoo()
   with (x) {
      bar = 4
   }
is syntactic sugar for something like:

   fun Foo.anonymous() {
      this.bar = 4
   }

   val x = makeFoo()
   with(x, Foo::anonymous)

You could absolutely write any of these yourself. For instance, consider this quick example I threw together: https://pl.kotl.in/S-pHgvxlX

The type inference is doing a lot of heavy lifting, i.e. taking a lambda and automatically turning it into an anonymous extension function, but it's nothing that you cannot do yourself. In fact, a wide range of libraries write what might look like macros in Kotlin by leveraging this and the fact you can define your own inline operators (i.e. https://pl.kotl.in/TZB0zA1Jr).

This isn't possible in many other languages because taking a generic type definition and letting it possibly apply to every single existing type is not exactly popular. Combined with Kotlin's ability to extend nullable types (i.e. this = null) as well makes for a language system that wouldn't work in many other flexible languages.


Fair enough, I retract my previous comment. Unfortunately there seem to a lot of pieces that are unfamiliar here so I'm not really able to understand parts of this but I trust that you understood what I was saying well enough to know that it was wrong.


What’s an example of? The only thing I can think of is providing approval per section, but that doesn’t really scale well


And Claude Code run inside VSCode does as well. An extension to give those extra integration features to a CLI agent to me is far better.


Does clicking on the ad cost the spammer a lot of money


Yes, which is one of two reasons why I use a blocker called adnauseum. It an adv locker that “clicks” on every single ad it sees, as well as hides it from my view. This makes my ad profile useless, and also costs them money.


you should probably think about the fact that ad platforms expect and design for fraudulent and bot clicks before you assume that this actually costs anyone money.


The question is, is the scammer taking donations from kids with cancer or Google the more worthy entity to profit from the situation? It's a tough decision.


> This makes my ad profile useless

I have a theory that it doesn't. Which set of companies' logic is more likely?:

Is LadyCailin a "tree-hugging liberal"? LadyCailin clicked on a lot of Sierra Club and PETA ads, so yes. Good, we will add LadyCailin to this list.

Is LadyCailin an "extremist right-wing nazi"? LadyCailin clicked on a lot of prepper and gold ads, so yes. Good, we will *also* add LadyCailin to this other list.

OR

Is LadyCailin a "tree-hugging liberal"? Well, they clicked on these ads, so we think so, but then they clicked on these other ads, so we're not sure. Then she clicked on these other ads, now we don't have any idea.

Speaking from personal experience: Because some people have used my phone number and email address as their own, I get emails for one political party and text messages for the other political party.

It doesn't make my ad profile useless to the people sending me ads.

Give your phone number to both U.S. political parties. Congratulations you will get spammed by both. I doubt they are cross-checking.


Won’t Google ban your account if they notice this


As per other comments, if it’s making them money, why bother banning it


Depends on bot-detection and if its a CPC or CPA campaign


That dismissal hardly buys credibility


Neither did the dismissal of AI in the article. I'd classify it as "not even wrong" in that the factual parts are true, but the conclusions are utter nonsense as ChatGPT can be extremely useful regardless of the claims being true.


We all know they Apple lack the capability, not a choice.


First time I read something like that about Perl. Is this personal experience during the Perl peak period or extrapolation from phrases


The idea that a company DNA somehow lives over 100 years and maintains the same track record is far fetched.

that the OpenAI tech bro are investing in AI using a grown up ROI is similarly far fetched, they are burning money to pull ahead of the reset and assume the world will be in the palm of the winner and there is only 1 winner. Will the investment pay off if there are 3 neck and neck companies ?


This looks like a ticketing cli


That's exactly what this is, but it's one that's designed with coding agents in mind as its principle users.


On that topic and without personal attacks cause he must be better at this than most people and most people here.

How did he go from politics social activism to AI founder


Better at what though? Maybe he's just great at getting hired and promoted, without the benefit of actual skills or deep understanding of anything, and now finds himself in ignorance of all that he surveys. I've known many people like that.


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

Search: