www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - F# = D + reflection

reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
I just found this language on a semi-random website ..

A Link to a new language from Microsoft!
It's said to combine the best of staticly-typed languages and functional 
languages and scripting languages.

Two points grabbed my attention:
* Supports Reflection
* Integrates with .NET

I didn't try it out yet, I jumped here right away to share this

http://research.microsoft.com/fsharp/fsharp.aspx

It seems like it's D with Reflection and a good library!
Jun 07 2007
next sibling parent Babele Dunnit <babele.dunnit gmail.com> writes:
Hi Hasan,

Hasan Aljudy Wrote:
 A Link to a new language from Microsoft!

we needed it! :)
 It seems like it's D with Reflection and a good library!

from the "getting started": ------- let res = (if x = 23 then "correct" else "incorrect") ------- uh? "let"?? It was since Sinclair BASIC I dont see a "let" instruction. And uses the same operator ("=") for assignment and test, which could be nice, but means the parser will be more complex than needed.. and then... guess what? conditional compilation! #ifdef!! I stop here. thumbs down. No way. D is not another planet, is another GALAXY. And if you need something like that, go Python. Bab.
Jun 08 2007
prev sibling next sibling parent eao197 <eao197 intervale.ru> writes:
On Fri, 08 Jun 2007 10:51:33 +0400, Hasan Aljudy <hasan.aljudy gmail.com>  
wrote:

 http://research.microsoft.com/fsharp/fsharp.aspx

 It seems like it's D with Reflection and a good library!

F# is not like D :) AFAIK, it is yet another incarnation of ML [1], now for .NET platform [1] http://en.wikipedia.org/wiki/ML_programming_language -- Regards, Yauheni Akhotnikau
Jun 08 2007
prev sibling next sibling parent reply Sean Kelly <sean f4.ca> writes:
Hasan Aljudy wrote:
 
 It seems like it's D with Reflection and a good library!

And guaranteed to only work on Windows, count me in! Sean
Jun 08 2007
next sibling parent reply "Bent Rasmussen" <incredibleshrinkingsphere gmail.com> writes:
As a .NET language, how would it only work on Windows?

(Yes, it sounds like they're two different worlds, F# and D, not at all 
alike)

"Sean Kelly" <sean f4.ca> wrote in message 
news:f4bss6$1obn$1 digitalmars.com...
 Hasan Aljudy wrote:
 It seems like it's D with Reflection and a good library!

And guaranteed to only work on Windows, count me in! Sean

Jun 08 2007
parent reply Sean Kelly <sean f4.ca> writes:
Bent Rasmussen wrote:
 As a .NET language, how would it only work on Windows?

Does anyone actually use .NET on other OSes? So far I don't see Mono as more than an intellectual curiosity. Sean
Jun 08 2007
next sibling parent eao197 <eao197 intervale.ru> writes:
On Fri, 08 Jun 2007 20:32:29 +0400, Sean Kelly <sean f4.ca> wrote:

 Bent Rasmussen wrote:
 As a .NET language, how would it only work on Windows?

Does anyone actually use .NET on other OSes? So far I don't see Mono as more than an intellectual curiosity.

AFAIK, Nemerle language mainly developed on Mono under Linux. -- Regards, Yauheni Akhotnikau
Jun 08 2007
prev sibling next sibling parent "Bent Rasmussen" <incredibleshrinkingsphere gmail.com> writes:
That's a pretty bold statement. If mono can run all Windows Forms 
applications that don't use any special namespaces (designed for Vista), 
it's a bit more than an intellectual curiosity for many people. :-) Besides 
that...

http://www.mono-project.com/Software


"Sean Kelly" <sean f4.ca> wrote in message 
news:f4c0at$1um7$1 digitalmars.com...
 Does anyone actually use .NET on other OSes?  So far I don't see Mono as 
 more than an intellectual curiosity.


 Sean 

Jun 08 2007
prev sibling next sibling parent Leandro Lucarella <llucax gmail.com> writes:
Sean Kelly, el  8 de junio a las 09:32 me escribiste:
 Bent Rasmussen wrote:
As a .NET language, how would it only work on Windows?

Does anyone actually use .NET on other OSes? So far I don't see Mono as more than an intellectual curiosity.

There are many FLOSS applications using Mono (unfortunately). AFAIK there is some intention to migrate all the GNOME project to Mono (unfortunately, again). -- LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation ------------------------------------------------------------------------ E-Mail / JID: luca lugmen.org.ar GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2 GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2 ------------------------------------------------------------------------ When I was a child I had a fever My hands felt just like two balloons. Now I've got that feeling once again I can't explain you would not understand This is not how I am. I have become comfortably numb.
Jun 08 2007
prev sibling parent nick <nick.atamas gmail.com> writes:
Sean Kelly wrote:
 Bent Rasmussen wrote:
 As a .NET language, how would it only work on Windows?

Does anyone actually use .NET on other OSes? So far I don't see Mono as more than an intellectual curiosity. Sean

Mono is used quite a bit to run in-house applications at some major companies. I don't know about commercial apps, but it's certainly not at all just an intellectual curiosity.
Jun 09 2007
prev sibling next sibling parent Dejan Lekic <dejan.lekic gmail.com> writes:
Well, since there are two open-source implementations of the .NET platform I
think it could work on various unices as well.
Jun 08 2007
prev sibling parent reply Rowan <rowan csse.uwa.edu.au> writes:
Um - F# is basically a port of OCaml to .NET.  OCaml (Caml generally) has been
around a lot longer than D, and in my opinion reflection is pretty minor
compared
to the other advantages you'll get with OCaml and F#.

And, OCaml certainly works on many platforms - I believe the compiler can target

And, F# works under Mono.  So, your guarantee that it only works on Windows is
wrong.

Those of us that know are still waiting for a language called E to come out that
is only somewhat behind the programming model offered by F# (and OCaml).
Sep 12 2008
parent reply bmeck <bmeck stedwards.edu> writes:
The one big complaint for F#, OCAML etc is that they may have features but are
not suited for programming system level code. For example, F#'s speed is
comparable to C# which is faster than but comparable to Java. I use D for speed
and a lot of meta programming using templates which I could use in other
languages but it would be done at run time rather than compile time and require
a large user installed library.
Sep 12 2008
parent reply bearophile <bearophileHUGS lycos.com> writes:
bmeck Wrote:
 The one big complaint for F#, OCAML etc is that they may have features but are
not suited for programming system level code. For example, F#'s speed is
comparable to C# which is faster than but comparable to Java.<

I don't know how much OCaml is fit as system language, maybe it's not much fit. But regarding speed, good OCaml code isn't that far from C-like languages: http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=dlang&lang2=ocaml Bye, bearophile
Sep 12 2008
parent bmeck <bmeck stedwards.edu> writes:
F# says on its site its speed compares to C#
http://research.microsoft.com/fsharp/fsharp.aspx
Sep 12 2008
prev sibling next sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
lol, sorry for my "stupid" title,
I just felt excited when I was reading the description of the language 
and I jumped to conclusions before even trying the language.

Yes, the syntax seems to differ, but as for me, I still would like to 
give it a try.

Anyways, in my opinon, D needs these two things .. reflection and .net 
integration.

Hasan Aljudy wrote:
 I just found this language on a semi-random website ..
 
 A Link to a new language from Microsoft!
 It's said to combine the best of staticly-typed languages and functional 
 languages and scripting languages.
 
 Two points grabbed my attention:
 * Supports Reflection
 * Integrates with .NET
 
 I didn't try it out yet, I jumped here right away to share this
 
 http://research.microsoft.com/fsharp/fsharp.aspx
 
 It seems like it's D with Reflection and a good library!
 
 

Jun 08 2007
next sibling parent BCS <ao pathlink.com> writes:
Reply to Hasan,

 lol, sorry for my "stupid" title,
 I just felt excited when I was reading the description of the language
 and I jumped to conclusions before even trying the language.
 Yes, the syntax seems to differ, but as for me, I still would like to
 give it a try.
 
 Anyways, in my opinon, D needs these two things .. reflection and .net
 integration.

While you are giving it a try, keep an eye out for cool things that D might want to shamelessly steal.
 
 Hasan Aljudy wrote:
 

Jun 08 2007
prev sibling parent reply justsomeone <spammepls gmx.com> writes:
f# maybe nice, but it got the same drawback like c#, it's built for .net - so it
just satisfy the needs of ms-programmers (yeah, i know mono... nothing more to
say).
but i fully agree with you in one point - d needs a reflection api and dynamic
class loading like java...
Jul 05 2007
parent Robert Fraser <fraserofthenight gmail.com> writes:
jThe more I look into this, the more I realize that D already has most of the
reflection capabilities it needs.

Flectioned: The syntax could be easier to use (not Thomas's fault, D just isn't
that flexible with regards to runtime type info), but traced exceptions, etc.
make this a VERY viable option. Better Windows support would be nice, but I
tend to compile the .map file in as a resource and load it from there, so no
harm done. The main problem is that while reflection is possible, introspection
(getting the list of methods/fields a class/module has, etc.) is more
difficult. It's inability to create a class with an arbitrary constructor is a
problem, too.

drefgen/rodin: Haven't used it yet, but this looks like it fixes a lot of the
shortcomings of runtime info (Flectioned), but requires that the coder run the
tool on their code and compile extra stuff in, which makes it ineffective for
generalized reflection on arbitrary code.

DDL: Not technically for reflection, but its dynamic loading facilities are
impressive, to say the least, so for plugins, etc., it definitely beats out
trying to work around D's DLL incompatibilities. I haven't used it in a while
(since the old days when it was Mango-based), but I think Pragma is working on
it again, which is great news (since it means my D project is no longer
blocked...). For 99% of the uses of dynamic classloading, this is perfect.

As far as relection goes in general, it's somewhat of an anti-pattern in most
cases it's used, anyway. See:
 http://www.informit.com/isapi/product_id~%7B7DE69993-3EF5-4354-9E10-9F8A535909F1%7D/content/images/0201310058/samplechapter/blochch7.pdf

Item #35.

My summary of it:
- You lose all the benefits of compile-time type checking
- The code required to perform reflective access is clumsy and verbose (IMO,
less so in D than in Java, Flectioned and DDL have pretty interfaces)
- Performance suffers

The main uses are RPC systems, component-based application builder tools, code
analysis tools, interpreted embedded systems, etc.

He suggests you use interfaces and only use reflection to instantiate instances
of classes, which is totally possible in D:

// Warning: Totally untested
module example;

import object.ClassInfo;
import tango.io.Stdout;

interface IFriendlyPerson
{
    void sayHello();
}

class Fraser : IFriendlyPerson
{
    void sayHello()
    {
        Stdout("Why hello there, world!");
    }
}

void main()
{
    IFriendlyPerson me = cast(IFriendlyPerson)
ClassInfo.find("example.Fraser").create();
    me.sayHello();
}

While I think better language support for reflection is a good idea, I'm
starting to think it's probably less important than:
- Fixing/working more with const stuff
- Struct constructors
- Macro syntax
(All which are supposedly in the works right now), and anything else coming in
the 2.0 branch.
Jul 05 2007
prev sibling parent Jan Claeys <usenet janc.be> writes:
Op Fri, 8 Jun 2007 16:15:25 -0300
schreef Leandro Lucarella <llucax gmail.com>:

 There are many FLOSS applications using Mono (unfortunately).
 AFAIK there is some intention to migrate all the GNOME project to Mono
 (unfortunately, again).

Maybe Novell wants that, but others are using Python, C or C++ to develop GNOME applications. Most of the core GNOME stuff is either C or Python (and also some C++). That said, there are several great Mono-based applications for GNOME too. -- Jan Claeys
Jun 09 2007