[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why isn't a method (incuding its every single instruction)

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 16
Thread images: 1

File: endless suffering and torment.jpg (33KB, 512x710px) Image search: [Google]
endless suffering and torment.jpg
33KB, 512x710px
Why isn't a method (incuding its every single instruction) an object?
>>
>>62160970
Because it's just a block of code that's executed.
You can't create instances of it, it doesn't have state etc.
>>
>why isn't behavior a tangible thing?
>>
>>62160970
language?
>>
>>62160970
It is in JavaScript. Kind of.
>>
Sure they can. If you smoke a bit of the OOP kush your Executors, Services and Strategies are what you want.
>>
An object is a self-contained set of stored values that can be duplicated, passed around, accessed publicly to a certain extent and acted on using methods specific to that object.
While you can duplicate and pass around a function/method, you can't store data in them, you can't modify them (in most languages), and you can't access specific data in them if it isn't returned.
>>
>>62160970
>Why isn't a method (incuding its every single instruction) an object?
It can be.

>>62161979
>While you can duplicate and pass around a function/method, you can't store data in them,
Closures?

>you can't modify them (in most languages)
In some you can, though.

>and you can't access specific data in them if it isn't returned.
Immutable objects exist, as well as private object members too.
>>
>>62160970
depends on the language. js has it, java sort of has it, others have it too
>>
>>62160970
And what would be the use case for that?
>>
>>62162438
You can pass a callback function bound to the object, for example.
>>
>>62162446
Just use a closure.
>>
>what are delegates
>>
>>62161030
physicsfag please go
>>
>>62160970
It can be in a language with reflection
>>
>>62163172
If free standing functions exist in the language, sure.
Thread posts: 16
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.