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

Amusingly horrible question. Functional programming languages don't typically have class-based or prototype mechanisms, so why on earth would a named set of object interaction mechanisms be relevant - let alone displaceable?

I also think it is funny the status quo in language design is to effectively combine objects and functions but programmers and writers are not acknowledging this fusion. Ocaml, Javascript, F#, Scala, Ruby, Nemerle ... with varying ease, these languages all let you create lambdas, compose functions, functions as values. Even mainstream languages like C# and Java are awkwardly moving in this direction.

Scala does some crazy stuff to make "fusion" interesting. They allow objects in pattern matching by providing a specific mechanism for allowing an object to expose encapsulated behavior (extractors). Functions all belong to a parametric set of classes and have an "apply" method e.g. def add(x:Int,y:Int) = x+y is really Function2[Int,Int,Int]{ def apply(x:Int,y:Int):Int = x + y }. Likewise, any class or singleton object can invoked as a function by providing an "apply" method implementation.


I think it's because you can easily make your own object system in a functional language.

Make yourself a function (representing an object) that takes in a parameter that it uses to dispatch a function contained in it. Return the function, and the user can then call that with their args. And you still maintain encapsulation, too, because the returned function may access stuff that was only available inside the containing closure (where it was dispatched).

Put all of this together in a nice "class" macro, and bam, you've got objects.

Though, yeah, I guess this would be really tedious if your functional language didn't have good macros.


"And you still maintain encapsulation, too, because the returned function may access stuff that was only available inside the containing closure (where it was dispatched)."

That only works if your functions can maintain state and if they can, well they're basically objects aren't they...


That's my point. You don't need to have a separate special construct for objects, or any kind of support for them, when you have first-class functions.

As for state information, you could just put a 'let' inside there with your variables, and call mutators on them from inside the "object"'s functions.

Hmm, I think all these Scheme-centric classes I've taken have warped my mind. I should seek therapy.


> when you have first-class functions.

This isn't enough without the ability to close over the lexical environment. See Python pre 3.0, without the dictionary/list "hacks".


Well, strictly speaking, they're closures.

There's a lot of overlap between objects and closures, though using one or the other will frame the problem in a slightly different way.

See also: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...


+1 Scala. Open JVM, open compiler, open libraries, open language design/research community, and 3 books on the way. More importantly, Java and C# are throwing in lots of functional programming features after the fact. They will likely never have the uniform object/functional model Martin Odersky has already achieved in Scala.


akes perfect sense under the Evolutionary Psychology framework. If something bad is happening around you, you should be trying to overfit the data to avoid your demise. Assuming an escapable, cataclysmic event as a fitness function - only those growing paranoid and neurotically "connecting the dots" are going to make it out alive to breed again.


"The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized."

The Constitution is our Contract with the Government, and the Judicial Branch our process. Writing your Representative helps, but giving to lawyers who fight and defend the Constitution from overreaching/overreacting Government Officials is equally important and extremely patriotic IMO.


I don't want to go political here, but I'd simply remind you that customs has _always_ had the ability to inspect and detain materials crossing the border, whether your personal property or not. It is not unreasonable for the federal government to control materiel moving over the border. There's not even a "reasonable clause" notion here, as a complete and thorough search are asssumed at ports of entry -- otherwise the government would be defrauding the social contract by not being concerned enough about what's happening there.

How else would you run a border? Hey guys, what do you feel like showing me that you're moving? This laptop smells like it has encrypted money on it?

They're not investigating a crime, they're controlling movement. That's their job.

There used to be (and still is, I think) a crime of carrying so much undeclared cash across the border -- whether or not its yours or not. One could argue that the IP contained on a laptop easily could be more valuable than the cash limit, but there are no similar regulations on IP movement. With cell phones becoming e-wallets, seems like it would be easy to walk across the border with a couple hundred k loaded on your cell phone. Strange world, eh?

Encrypt your data and put it in the cloud. Much easier to do than either figuring out what a perfect world would look like or implementing it.


$10,000 is the limit for transporting undeclared "financial instruments" across the border.

This can be in the form of cash, certificates of deposit, bonds, stocks, and I suppose anything else that has the semblance of real money (gold, etc).


Scala currently answers every one of the author's beefs, except for reflection. Scala runs on the JVM and is a Functional/OO Hybrid language that supports static typing and type inferencing. Bottom line - full Java interop and removal of Java's high cerimonial cost without the speed penalty imposed by dynamic languages.


high ceremonial cost

That is an excellent turn of phrase. I think I will borrow it.


this is exactly what it is doing. it's a javascript lib that exposes an ajax connection (fancifully named "TCPSocket") that is proxying a socket connection through the Orbitd server. if there isn't strict control of client IP addresses and outgoing IP/port at Orbitd, then you should expect folks are going to abuse/hack your server for proxying who knows what from where.


This is going to be a giant security nightmare.


This seems to be the instinctive response of developers in other areas when exposed to a new client-server system...particularly a proxy or relaying system.

But is BIND and the DNS system a "security nightmare"? Is Squid a security nightmare? Apache's mod_proxy, a security nightmare? Postfix or Sendmail or Qmail or Exim, all security nightmares? IRC? OK, maybe SMTP and IRC are security nightmares...but, one could easily argue that it's because their goals include "many-to-many open communication", and not because securing them would be difficult. After all, IMAP/POP3 moves mail around, just like SMTP, and it manages to be locked up nice and tight without even trying very hard.

I'm not saying Orbited isn't a security nightmare. I'm just saying that it's a client-server proxying and/or relaying system, just like all of the systems listed above, and that does not, by definition, make it a security nightmare. If the developers have experience building proxy systems and/or take the time to understand the security requirements of such a system, it'll be just fine. Just because securing a particular technology is sorta hard, doesn't mean you shouldn't build the technology. It just means you need to allocate some of your development resources to solving those security problems.


This is a bit different to normal applications though.

Normal apps: Developer writes application. Code is installed via user engagement with a package management or installation system.

Comet apps: Developer writes application. Code is pulled and executed by (almost) every vistor to the website it is deployed on.

If the code could open sockets to arbitrary destinations then a high traffic site could be used to spawn a very effective DDOS or distribute hacking attempt.

Of course for Orbited this isn't relevant as the browser security model limits connections to the originating host. So you can't, say, embed javascript into Slashdot.org that does:

End users >>> DDOS attack target.

Instead you get:

End users >>> Slashdot.org proxy >>> DDOS attack taget.

(Which is obviously a total waste of time as any attack via this method would be predicated on having control of Slashdot.org in the first place.)


Your average web programmer doesn't even check for SQL injection or XSS attacks. Your average web programmer though, likes to adopt new technologies because of some "buzz." Your average web programmer will read the basic tutorial, which will cover examples, which are not to be used in a production environment. However these examples will make their way into production environments and we'll see a bunch of attacks pop up. I hope I'm wrong, but we'll have to wait and see..


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

Search: