Let me be even more specific. If you could come up with a workable solution 
to the c = a*b => mul(c, a, b) problem, you could write a paper on it and 
get a lot of kudos for doing so. Even after 50 years, it's still 
essentially an open problem in modern compiler design.

Move semantics and rvalue assignment in C++ gets you partially the way 
there. That's a significant advance, technologically, based around the 
observation that previously, languages were conflating two concepts which 
should be distinguished. There is probably another equally simple 
observation that will lead to a solution to this problem. But currently, I 
don't think it has been solved fully. 

I could be wrong. I'm a mathematician after all, not a computer scientist.

Bill.

On Thursday, 21 August 2014 19:03:08 UTC+2, Bill Hart wrote:
>
> Oh, I should mention, the c = a*b => mul(c, a, b) problem is probably 
> soluble in D with a much cleaner and easier to compile solution than C++ 
> offers. D metaprogramming is strictly more powerful than that of C++.
>
> On Thursday, 21 August 2014 18:59:39 UTC+2, Bill Hart wrote:
>>
>>
>>
>> On Thursday, 21 August 2014 18:23:48 UTC+2, Volker Braun wrote:
>>>
>>> Incidentally, the whole argument type-dependent function dispatch is at 
>>> the core of the GAP language (though you have to recompile the GAP kernel 
>>> to change it). And GAP predates K&R C. 
>>>
>>
>> There are other languages which have used it. That's not particularly 
>> novel.
>>
>> It's just the "other" way of doing object orientation.
>>
>> There is one significant issue with it. To do arithmetic efficiently on 
>> composite types, you need to be able to replace c = a*b with mul(c, a, b).
>>
>> Using the class based approach, this is possible using metaprogramming. 
>> We do this in flint. Unfortunately, the flint C++ module takes minutes per 
>> file to compile and blows up many version of gcc and all versions of MSVC 
>> (internal errors).
>>
>> So it's not such a huge loss that you can't use template class 
>> metaprogramming in a language like Julia (template class metaprogramming 
>> has other major issues which make it essentially unusable in practice 
>> anyway, such as needing to recompile to change anything).
>>
>> I don't know a solution to the c = a*b => mul(c, a, b) problem. Nimrod 
>> claims to have found some sort of solution, called term rewriting macros. 
>> But I really don't know enough about them to evaluate their effectiveness 
>> as a solution to this problem.
>>
>> Julia will have to solve the problem some day, though it will be hard.
>>
>> In my language I (theoretically) get around it by defining two kinds of 
>> type. One is an arithmetic type, which has the above semantics. The other 
>> is a usual type which has the usual semantics. But I've not fully 
>> implemented the solution, so I don't know to what extent it can really be a 
>> solution to the problem. Either way, it will be really, really hard to 
>> implement in the "compiler".
>>
>> Bill.
>>
>>
>>> On Thursday, August 21, 2014 4:56:12 PM UTC+1, Bill Hart wrote:
>>>>
>>>> Thus the language is formally extensible at no cost and in an extremely 
>>>> simple way that the user can easily do themselves. 
>>>>
>>>  
>>> Depends on your point of view. If you want to tie together different 
>>> third-party libraries then it can quickly become a liability that you can 
>>> just redefine everything. 
>>>
>>> julia> getindex(a::Array{Int, 1}, b::Int) = print("test")
>>>> getindex (generic function with 140 methods)
>>>>
>>>
>>> Type this into the REPL on your colleague's computer who just left to 
>>> get a coffee and see if he ever figures that one out. My bet would be that 
>>> he's not going to get any work done until the next restart ;-)
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to