HNHacker News
TopNewBestAskShowJobs

harshavr

92 karma · joined March 18, 2008

interested in new ideas on design of programming languages
submissionscomments
harshavr··on Scheme vs Common Lisp
On the whole macro debate, whatever one thinks the default behavior should be with respect to variable capture, the syntax-case macro system in scheme works on a representation of program code which is at a higher resolution than what lisp macros works on.

The macro can find out for instance, if an identifier used in its input is a free-variable, or if two identifiers share the same binding. Hence, it is possible to write a relatively short program to define defmacro in terms of define-syntax & syntax-case, but not the other way round. (a pretty short implementation & most of it is error checking - http://svn.plt-scheme.org/plt/trunk/collects/mzlib/defmacro....)

This also strikes me as a inconsistency in arc(albeit easily correctable), as it goes against the rule of not imposing restrictions on the user, by default. Even, if the default macro interface is something simple, the user should be able to write macros which work with syntax at a higher resolution if needed.

Also, if you use the most popular distribution, PLT scheme, you have all of reader macros, native hash tables, keyword arguments, a package repository. There is a really nice module system, along with other neat stuff like contracts, lazy modules, frp & of course the continuation based web-server. For OOP, there is Swindle, an analog of CLOS(not having used it, i don't know if it's just as good).

After R6Rs, there is a common module system and standard libraries for hash-tables even in the scheme spec.

The main flaw, it seems, is the relative lack of libraries as compared to other mainstream languages. In particular, what i miss is something like wxPython for scheme.

EDIT : turns out i spoke too soon, defmacro does have an environment object(http://www.lispworks.com/documentation/HyperSpec/Body/03_aad...) as a parameter, so it has some access to lexical info of its input form. To implement define-syntax, one would also need some way to output a syntax object and not just a s-expr. Couldn't find any defmacro implementation of define-syntax on the net.

harshavr··on Nathan Myhrvold’s Patent Extortion Fund Is Reaping Hundreds Of Millions of Dollars
>> The patent system was set up to be taken advantage of in this exact way

Pheraps, but the question is should it be set up this way? Two justifications of the patent system are

- inventors have more incentives, hence new ideas will emerge faster

- when these new ideas/inventions emerge, the patent ensures that it is openly documented and hence, can be used by everyone after the patent expires.

And the price that one pays for this is that noone can use the idea without a deal with the patent owner. Is the price worth the benefit? This depends on things like a) how easy it is to discover the idea

Two extreme cases would be say , a cure for AIDS vs. one-click patent

b) the existence and the power of non-patent incentives for the discovery of the idea

Would the idea be discovered without patents? Ideas/inventions are discovered all the time simply because one is working on some problem and one needs new tools to solve it. The university system is also a strong alternative system of incentives. But, there will be holes in what these systems incentivize.

c) how many things depend on the thing being patented?

This is a kind of an amplifying factor. Say, there a huge number of systems which depend on an idea. If the idea could be discovered without the patent system, the economy loses a lot of value and on the other side if patents were what made the discovery possible, then the patent system has caused great gain. Software, where ideas are built upon each other at great speed is full of these amplifying factors. A patent on say, garbage collection or oop, if granted, would affect a huge number of systems.(though, probably this would have expired before the 90's, but consider more recent ideas like say, stm.) the the rapid growth of the computer industry in the current phase increases this amplifying factor.

d) The negative effect of patents on the culture of open sharing of ideas. Precisely, because people are doing this without making money, there is little scope for licensing from the patent holder. And this culture has a lot of value, intrinsic, educational and economic.

Abolishing patents would probably be bad,(unless we can make alternative systems of incentives work. prizes?) But the important point here, is that there are a lot of free parameters - the length of patent, limitations on licensing fees, the nature of things which could be patented(i have used ideas/inventions interchangeably, but this is a controversial issue)

Deciding optimal values for these parameters is a complex task and it isn't clear how one should be doing this. For instance, the length of the patent, if decided in a market would probably vary with the field in which the idea applies. For some fields, the optimal parameter might well be 0.

harshavr··on CA State Supreme Court rejects noncompete clauses
Your version of B is actually distinct because it still requires the individual to explicitly limit his choices beforehand. It would still leave open an option for the following to happen,

A farmer after a poor harvest faces the prospect of starving to death, goes to a local landlord for money in exchange for which he becomes a bonded labourer for life. The next season he tries to run away. But the government, which operates under principle A, catches him and forces him to return to slavery. I am uncomfortable with the government actually doing this and this is why i reject A.

There is an argument made in the context of minimum wage that it actually hurts the people whose work value is less than the minimum wage as employers wont hire them anymore. I am not arguing for or against minimum wage, but want to point out a counterargument which might work in the example given above. When the landlord knows that if one person refuses slave labor in exchange for money, he can hire some else. But with a law forbidding such contracts in place, the landlord doesn't have this option. In effect, the law enhances the bargaining power of the labourer by restricting his options.

In effect, this is the same as the as argument pointed out in the thread above of there being a Prisoner's Dilemma.

harshavr··on CA State Supreme Court rejects noncompete clauses
This is an interesting example. But to take the question further, exactly what choices do you allow an individual to trade away? As an extreme, will you allow an individual to trade his life away(or as in The Merchant of Venice, one pound of flesh), if it can be used in some way to obtain a better contract from someone else? In the poorer parts of the world, people sometimes sell themselves into slavery.

The options here are either A)the extreme position - an individual is free to make any contract whatsoever and is henceforth bound by that contract(the government is the enforcer), or B)there is a set of fundamental freedoms which one can't freely trade away.

Are you advocating A or B? If B, one would need to find some basic principles which determine what freedoms can't be given up voluntarily.

harshavr··on The Implementation of Functional Programming Languages (free ebook)
the parent page has download links - http://research.microsoft.com/users/simonpj/papers/slpj-book...
harshavr··on My analyst warned me, but metaprogramming was so beautiful I got another analyst
The thing that the original article(by atwood) seems to be complaining about is not actually metaprogramming. It seems more like the standard gripe that functional programmers have about state, even though it is not phrased that way.

He is objecting to dynamically changing some of the methods in the string class leading to subtle bugs as some code is written assuming the old string class and some using the new string class. Pheraps just explicitly define a separate custom-string class, or as he points out use mixins.

harshavr··on Oil price shock means China is at risk of blowing up
>>China needs to be knocked back a couple of pegs. We have been looking at nearly 1/6th of the population of the world controlled by an incredibly repressive regime

For this point to have any validity, you'll need to have a strong argument that a smaller rate of economic growth will lead to more political freedom. This is not at all clear as the present regime has held onto power through many crises.

On the other hand, an economic slowdown might very well mean that fewer people coming to the cities to look for a job will find one and an oil price price hike leading to an increase in the price of basic commodities might directly hit some of the poorest in a bad way. A significant humanitarian effect, without a political upheaval.

harshavr··on Want to Write a Compiler? Just Read These Two Papers
some exceptions i can think of :

clos and the meta object protocol - the idea of leaving the language open for the user to change by using a metaclass

hygienic macros

first class continuations

monads

functional reactive programming

the first few developed in the 80's while the last is quite recent

harshavr··on The Sequel To SICP
sounds really interesting. the course page has sets of projects, and assignments, but are there lecture notes up online anywhere?
harshavr··on The .NET Framework is big. Really, really big.
which implementation is this?
← PreviousPage 2 of 2