Re: Time for std.reflection

2012-07-22 Thread Dmitry Olshansky
On 23-Jul-12 10:47, Philippe Sigaud wrote: On Mon, Jul 23, 2012 at 8:41 AM, Dmitry Olshansky wrote: On 23-Jul-12 10:30, Philippe Sigaud wrote: Well you're the resident crazy-stuff-during-compilation guy. Ah! I wish. I had this wonderful idea of having code be parsed at CT, semantically

Re: Time for std.reflection

2012-07-22 Thread Andrei Alexandrescu
On 7/23/12 2:39 AM, Jacob Carlborg wrote: On 2012-07-22 16:28, Andrei Alexandrescu wrote: Something like that. Note that such a query is not particularly OO-ish, because getting a class' cone (totality of subclasses) works against the modularity that inheritance is meant for. I don't think we s

Re: Time for std.reflection

2012-07-22 Thread Philippe Sigaud
On Mon, Jul 23, 2012 at 8:41 AM, Dmitry Olshansky wrote: > On 23-Jul-12 10:30, Philippe Sigaud wrote: >> >> >>> Well you're the resident crazy-stuff-during-compilation guy. >> >> >> Ah! I wish. >> >> I had this wonderful idea of having code be parsed at CT, semantically >> analyzed, transformed in

Re: Optional name mangling

2012-07-22 Thread Walter Bright
On 7/22/2012 6:12 AM, Stuart wrote: Okay, but if you had a keyword - say, "extern(rawC)" - that did no mangling whatsoever, then I could run implib without manually editing every single damn line in every Microsoft .def file by hand!!! Surely that's a good idea? I agree, it's a pain, and a poin

Re: Time for std.reflection

2012-07-22 Thread Dmitry Olshansky
On 23-Jul-12 10:30, Philippe Sigaud wrote: Well you're the resident crazy-stuff-during-compilation guy. Ah! I wish. I had this wonderful idea of having code be parsed at CT, semantically analyzed, transformed into some machine code at CT and... , oh wait. I kind of did it... regex pattern

Re: Time for std.reflection

2012-07-22 Thread Jacob Carlborg
On 2012-07-22 16:28, Andrei Alexandrescu wrote: Something like that. Note that such a query is not particularly OO-ish, because getting a class' cone (totality of subclasses) works against the modularity that inheritance is meant for. I don't think we should make getting class cones particularly

Re: Just where has this language gone wrong?

2012-07-22 Thread monarch_dodra
On Sunday, 22 July 2012 at 21:10:08 UTC, Andrei Alexandrescu wrote: On 7/22/12 12:32 PM, David Nadlinger wrote: On Sunday, 22 July 2012 at 03:06:28 UTC, Jens Mueller wrote: Where is argmin defined? I couldn't find it. On the slide before that… ;) I think argmin is intuitive, popular, and us

Re: Time for std.reflection

2012-07-22 Thread Philippe Sigaud
On Sun, Jul 22, 2012 at 6:15 PM, Andrej Mitrovic wrote: > On 7/22/12, Philippe Sigaud wrote: >> 2) Why classes, as opposed to structs? > > I think either way you'd need reference semantics. Yeah, I agree, reference semantics look better. And since there is a lot of duplication (struct info is a

Re: Time for std.reflection

2012-07-22 Thread Jacob Carlborg
On 2012-07-22 02:16, Kapps wrote: I agree with most things proposed, however I am not a fan of the idea of mixing in runtime reflection info. Many times, you want reflection info from a type that is not your own, and thus I believe reflection should be generated by specifying a type. More importa

Re: Time for std.reflection

2012-07-22 Thread Jacob Carlborg
On 2012-07-22 06:48, Andrei Alexandrescu wrote: P.S. What this thing wit quoting a long message to make a 1-line point? Is that a thing? It's the new hip thing :) -- /Jacob Carlborg

Re: Time for std.reflection

2012-07-22 Thread Jacob Carlborg
On 2012-07-22 14:04, deadalnix wrote: I'd expect from std.reflection that it is able to reflect recursively from the marked starting point. I really hope so. -- /Jacob Carlborg

Re: Time for std.reflection

2012-07-22 Thread Jacob Carlborg
On 2012-07-21 23:44, Andrei Alexandrescu wrote: Walter and I discussed the idea below a long time (years) ago. Most likely it's also been discussed in this newsgroup a couple of times. Given the state of the compiler back then, back then it seemed like a super cool idea that's entirely realizable

Re: Time for std.reflection

2012-07-22 Thread Philippe Sigaud
On Sun, Jul 22, 2012 at 5:10 PM, Max Samukha wrote: > The language does not allow you to use CTFE parameter values as arguments to > __traits/templates. Therefore, to be able to build meta-objects at > compile-time, you would have to: > > static info = getModuleInfo!"std.algorithm"; Maybe I don'

Re: Time for std.reflection

2012-07-22 Thread Philippe Sigaud
On Sun, Jul 22, 2012 at 4:28 PM, Andrei Alexandrescu wrote: > std.reflection could become the lynchpin for dynamic library use; once the > library is loaded (with dlopen or such), the client needs to call > getModuleInfo() (a C function that can be found with dlsym()) and then get > access to poi

Re: Optional name mangling

2012-07-22 Thread Jacob Carlborg
On 2012-07-22 15:12, Stuart wrote: I don't know why implib is ignoring the /s switch, but it is. My .lib file doesn't have underscores, and there doesn't seem to be much I can do about it. Do I need a different version of implib or something? Shouldn't the /s switch add underscores to everything

Re: OSCON 2012 notes

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 17:58:20 -0400 Michel Fortin wrote: > > Marmalade, from what I see, is some sort of meta-platform you can use > to write something that works everywhere. It adds a new layer of > abstraction that can work on top of each platform. Good for them and > their developers, but I

Re: Just where has this language gone wrong?

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 23:15:06 +0200 Paulo Pinto wrote: > Am 22.07.2012 21:28, schrieb Nick Sabalausky: > > On Sun, 22 Jul 2012 20:24:19 +0200 > > Paulo Pinto wrote: > > > >> Am 22.07.2012 00:16, schrieb Nick Sabalausky: > >>> On Sat, 21 Jul 2012 23:14:12 +0200 > >>> "Stuart" wrote: > Let m

Re: Computed gotos on Reddit

2012-07-22 Thread Dmitry Olshansky
On 23-Jul-12 07:05, deadalnix wrote: On 23/07/2012 01:35, bearophile wrote: A discussion appeared few days ago on Reddit, about computed gotos: http://www.reddit.com/r/programming/comments/wld04/eli_benderskys_website_computed_goto_for/ http://eli.thegreenplace.net/2012/07/12/computed-goto-f

Re: Computed gotos on Reddit

2012-07-22 Thread deadalnix
On 23/07/2012 01:35, bearophile wrote: A discussion appeared few days ago on Reddit, about computed gotos: http://www.reddit.com/r/programming/comments/wld04/eli_benderskys_website_computed_goto_for/ http://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables/ The p

Rewrite rules?

2012-07-22 Thread bearophile
The Haskell GHC compiler supports the syntax to specify "rewrite rules", usually written in library code: http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/rewrite-rules.html http://hackage.haskell.org/trac/ghc/wiki/RewriteRules http://www.haskell.org/haskellwiki/GHC/Using_rules They are

Computed gotos on Reddit

2012-07-22 Thread bearophile
A discussion appeared few days ago on Reddit, about computed gotos: http://www.reddit.com/r/programming/comments/wld04/eli_benderskys_website_computed_goto_for/ http://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables/ Computed gotos are useful to write interpreters.

Re: D versionning

2012-07-22 Thread Joseph Rushton Wakeling
On 16/07/12 01:42, Jonathan M Davis wrote: I'm only against the proposed versioning scheme because I think that we need to stabilize things better (e.g. actually have all of the features that TDPL lists fully implemented) before we move to it. But I fully support moving to this sort of scheme in

Re: OSCON 2012 notes

2012-07-22 Thread Michel Fortin
On 2012-07-22 19:05:45 +, Nick Sabalausky said: On Sun, 22 Jul 2012 08:19:12 -0400 Michel Fortin wrote: On 2012-07-21 19:51:37 +, Nick Sabalausky said: On Sat, 21 Jul 2012 09:47:06 -0400 Michel Fortin wrote: And also, more and more it'd require ARM support to be competitive in

Re: Just where has this language gone wrong?

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 21:28, schrieb Nick Sabalausky: On Sun, 22 Jul 2012 20:24:19 +0200 Paulo Pinto wrote: Am 22.07.2012 00:16, schrieb Nick Sabalausky: On Sat, 21 Jul 2012 23:14:12 +0200 "Stuart" wrote: Let me just add, I really *like* the terse syntax of D. Lambdas, uniform function call syntax

Re: Just where has this language gone wrong?

2012-07-22 Thread Andrei Alexandrescu
On 7/22/12 12:32 PM, David Nadlinger wrote: On Sunday, 22 July 2012 at 03:06:28 UTC, Jens Mueller wrote: Where is argmin defined? I couldn't find it. On the slide before that… ;) I think argmin is intuitive, popular, and useful enough to warrant a presence in std.algorithm. Would anyone wan

Re: Just where has this language gone wrong?

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 20:24:19 +0200 Paulo Pinto wrote: > Am 22.07.2012 00:16, schrieb Nick Sabalausky: > > On Sat, 21 Jul 2012 23:14:12 +0200 > > "Stuart" wrote: > >> Let me just add, I really *like* the terse syntax of D. Lambdas, > >> uniform function call syntax, and so on. > >> > > > > Yea. I

Re: OSCON 2012 notes

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 20:46, schrieb Nick Sabalausky: On Sun, 22 Jul 2012 18:14:23 +0200 Paulo Pinto wrote: y :=&x[0] fmt.Println("Base adress ", y) size := unsafe.Sizeof(x[0]) fmt.Println("Size per element ", size) for i := 0; i< len(x); i++ { c

Re: OSCON 2012 notes

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 08:19:12 -0400 Michel Fortin wrote: > On 2012-07-21 19:51:37 +, Nick Sabalausky > said: > > > On Sat, 21 Jul 2012 09:47:06 -0400 > > Michel Fortin wrote: > >> > >> And also, more and more it'd require ARM support to be competitive > >> in the GUI area. > > > > Yes. B

Re: D versionning

2012-07-22 Thread Andrej Mitrovic
On 7/16/12, Walter Bright wrote: > The COFF route is the shortest route to doing it, and the most practical for > attracting devs, which is why it's the way we're going. Anyone know if MinGW and VC++ COFF object files are linkable? I might have even done this before without knowing, but I don't

Re: OSCON 2012 notes

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 18:14:23 +0200 Paulo Pinto wrote: > y := &x[0] > fmt.Println("Base adress ", y) > size := unsafe.Sizeof(x[0]) > fmt.Println("Size per element ", size) > for i := 0; i < len(x); i++ { > cell := uint64(uintptr(unsafe.Pointer(y))) + > (u

Re: OSCON 2012 notes

2012-07-22 Thread Caligo
Just curious, do you know if Alexander Stepanov uses D or not?

Re: Just where has this language gone wrong?

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 00:16, schrieb Nick Sabalausky: On Sat, 21 Jul 2012 23:14:12 +0200 "Stuart" wrote: Let me just add, I really *like* the terse syntax of D. Lambdas, uniform function call syntax, and so on. Yea. I used Java in college and ever since then I've been a fan of non-verbose systax - i

Re: Time for std.reflection

2012-07-22 Thread Wouter Verhelst
"Kagamin" writes: > On Sunday, 22 July 2012 at 14:28:45 UTC, Andrei Alexandrescu wrote: >> Yah, ideally all entities definable in a D module should be >> available via reflection. But I focused on things that e.g. the user >> of a dynamically-loaded library would be interested in: functions, >> c

Re: std.loader; depreciated and removed for 2.060

2012-07-22 Thread Alex Rønne Petersen
On 22-07-2012 18:37, Damian wrote: Are there any plans to provide an alternative solution in Phobos, now that it's been removed? I think it's something we can start looking at once we have std.reflection figured out (see relevant thread in this newsgroup). Once std.reflection exists, there is

std.loader; depreciated and removed for 2.060

2012-07-22 Thread Damian
Are there any plans to provide an alternative solution in Phobos, now that it's been removed?

Re: Just where has this language gone wrong?

2012-07-22 Thread David Nadlinger
On Sunday, 22 July 2012 at 03:06:28 UTC, Jens Mueller wrote: Where is argmin defined? I couldn't find it. On the slide before that… ;) David

Re: How to write OS in D?

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 17:26, schrieb 11: Question is simple: how do I write stand-alone programs with D and how to link them with asm? This should get you started, http://wiki.osdev.org/D_Bare_Bones

Re: OSCON 2012 notes

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 14:19, schrieb Michel Fortin: On 2012-07-21 19:51:37 +, Nick Sabalausky said: On Sat, 21 Jul 2012 09:47:06 -0400 Michel Fortin wrote: And also, more and more it'd require ARM support to be competitive in the GUI area. Yes. But there's an even bigger reason for ARM: Mobil

Re: How to write OS in D?

2012-07-22 Thread SomeDude
On Sunday, 22 July 2012 at 15:26:12 UTC, 11 wrote: Question is simple: how do I write stand-alone programs with D and how to link them with asm? Please, ask your questions in the http://forum.dlang.org/group/digitalmars.D.learn forum.

Re: OSCON 2012 notes

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 10:42, schrieb Nick Sabalausky: On Sun, 22 Jul 2012 01:24 -0700 Jonathan M Davis wrote: On Sunday, July 22, 2012 10:10:43 Paulo Pinto wrote: Am 22.07.2012 01:13, schrieb Nick Sabalausky: On Sat, 21 Jul 2012 14:41:05 +0200 Paulo Pinto wrote: Regarding systems programming, Go

Re: Time for std.reflection

2012-07-22 Thread Andrej Mitrovic
On 7/22/12, Philippe Sigaud wrote: > 2) Why classes, as opposed to structs? I think either way you'd need reference semantics. For example maybe you're doing code-generation at compile-time but you need to rename a class name in a typeinfo returned by std.reflection before doing any processign. W

Re: Time for std.reflection

2012-07-22 Thread Kagamin
On Sunday, 22 July 2012 at 14:28:45 UTC, Andrei Alexandrescu wrote: Yah, ideally all entities definable in a D module should be available via reflection. But I focused on things that e.g. the user of a dynamically-loaded library would be interested in: functions, classes. Plugins are usually

Re: Optional name mangling

2012-07-22 Thread Sean Kelly
On Jul 22, 2012, at 6:12 AM, "Stuart" wrote: > On Sunday, 22 July 2012 at 07:01:50 UTC, Walter Bright wrote: >> This is a very old issue. To be compatible with the output of the Microsoft >> C compiler, the Windows calling convention is: >> >> _name@nn >> >> but somehow Microsoft left off th

Re: improving std.array.array

2012-07-22 Thread monarch_dodra
On Sunday, 22 July 2012 at 13:04:18 UTC, David Nadlinger wrote: I hit some of the problems you described a little while ago. Jonathan and I came to the conclusion that the best solution is to default to the same element type as the passed range, while allowing any type which the element type is

How to write OS in D?

2012-07-22 Thread 11
Question is simple: how do I write stand-alone programs with D and how to link them with asm?

Re: Time for std.reflection

2012-07-22 Thread Max Samukha
On Saturday, 21 July 2012 at 21:44:52 UTC, Andrei Alexandrescu wrote: Please chime in with thoughts. Would someone want to pioneer this project? There are some questions. 1. static info = getModuleInfo("std.algorithm"); The language does not allow you to use CTFE parameter values as ar

Re: Just where has this language gone wrong?

2012-07-22 Thread monarch_dodra
On Sunday, 22 July 2012 at 03:06:28 UTC, Jens Mueller wrote: Where is argmin defined? I couldn't find it. Jens Argmin don't exist, but it could, and that's what counts. The important thing in these slides is proof of concept, rather than actual code snippets. However, std.algorithm does have

Re: Time for std.reflection

2012-07-22 Thread Andrei Alexandrescu
On 7/22/12 9:39 AM, Philippe Sigaud wrote: 1) About templates, would class/struct/function templates be in there? As in: class Foo(T,U) { ... } => class TemplateInfo { @property: string name(); FunctionInfo[] functions(); ClassInfo[] classes(); TemplateInfo[] templates(); //

Re: improving std.array.array

2012-07-22 Thread Philippe Sigaud
On Sun, Jul 22, 2012 at 1:46 PM, monarch_dodra wrote: > ...But I think it has one major drawback: You can't specify the type of the > array you want. For example, if you have a range of ints, and you'd want to > duplicate it into a range of doubles, well array doesn't allow that. > > The above e

Re: Time for std.reflection

2012-07-22 Thread Philippe Sigaud
On Sat, Jul 21, 2012 at 11:44 PM, Andrei Alexandrescu wrote: Nice! > class ModuleInfo { > @property: > string name(); > ImportInfo[] imports(); > DataInfo[] data(); > FunctionInfo[] functions(); > ClassInfo[] classes(); > StructInfo[] structs(); // includes unions > T

Re: Optional name mangling

2012-07-22 Thread Stuart
On Sunday, 22 July 2012 at 07:01:50 UTC, Walter Bright wrote: This is a very old issue. To be compatible with the output of the Microsoft C compiler, the Windows calling convention is: _name@nn but somehow Microsoft left off the _ and @nn in the DLLs. Hence, part of the whole reason for th

Re: Optional name mangling

2012-07-22 Thread Stuart
On Sunday, 22 July 2012 at 02:06:37 UTC, JImmy Cao wrote: Use either /s or /system Yes, but - at least with the version of implib I'm using - it has no effect.

Re: improving std.array.array

2012-07-22 Thread David Nadlinger
I hit some of the problems you described a little while ago. Jonathan and I came to the conclusion that the best solution is to default to the same element type as the passed range, while allowing any type which the element type is convertible to to be specified via an extra template parameter,

Re: OSCON 2012 notes

2012-07-22 Thread Michel Fortin
On 2012-07-21 19:51:37 +, Nick Sabalausky said: On Sat, 21 Jul 2012 09:47:06 -0400 Michel Fortin wrote: And also, more and more it'd require ARM support to be competitive in the GUI area. Yes. But there's an even bigger reason for ARM: Mobile devices, like iOS and Android. I'm not per

Re: Re-thinking D's modules

2012-07-22 Thread Wouter Verhelst
Russel Winder writes: > On Sat, 2012-07-21 at 02:17 +0200, Wouter Verhelst wrote: > [...] >> I don't know about cmake; and scons and waf are both crap, so it's not >> surprising they've not even heard of symbol versioning. > > I disagree, I think SCons and Waf (along with Gradle) make Make, CMake

Re: Time for std.reflection

2012-07-22 Thread deadalnix
On 22/07/2012 05:46, Jonathan M Davis wrote: Runtime reflection _must_ be opt-in. We do _not_ want to make all types pay the cost of having it. That means that however it's done is going to require that every type that has it be marked in one way or another to enable that functionality. I don't

Re: Time for std.reflection

2012-07-22 Thread deadalnix
On 22/07/2012 06:48, Andrei Alexandrescu wrote: On 7/21/12 8:41 PM, deadalnix wrote: I don't understand. Are theses structures generated by the compiler or some kind of libraries at compile time on a per needed basis ? These are all library structures. Internally they use std.traits, which in

improving std.array.array

2012-07-22 Thread monarch_dodra
array is one of my favorite features in Phobos. It is such a trivially stupid function, yet so incredibly useful/powerful. Just call it on any range, and you get a new raw array of the corresponding deferred type. Awesome! ...But I think it has one major drawback: You can't specify the type o

Re: Preview LLVM Deimos bindings

2012-07-22 Thread Jens Mueller
Sönke Ludwig wrote: > Am 20.07.2012 07:35, schrieb Jens Mueller: > >Hi, > > > >I've written some Deimos interface for LLVM. > >https://github.com/jkm/deimos-llvm/commits/master > > > >I'd like to get some feedback on those. > >Firstly to finish these and secondly to finish some guidelines that I'd

Re: Preview LLVM Deimos bindings

2012-07-22 Thread Pragma Tix
Am 22.07.2012 07:50, schrieb Sönke Ludwig: re the bindings for 3.0 or 3.1? I'm asking because at least some enum members have changed (don't exactly remember which). Looks like 3.1 https://github.com/jkm/deimos-llvm

Re: getting to know dmd and druntime

2012-07-22 Thread maarten van damme
Noticed I've sent this to digitalmars.D instead of digitalmars.D.learn. Sorry for that, going to resend this in D.learn.

getting to know dmd and druntime

2012-07-22 Thread maarten van damme
Right now I'm a bit confused. I assume that the garbage collector and some other parts from druntime need startup code. But what gets run first is my main method in the d file I compile. Does this mean that the first call to something in druntime calls that startup code? If not, what does get ran f

Re: Re-thinking D's modules

2012-07-22 Thread Russel Winder
On Sat, 2012-07-21 at 02:17 +0200, Wouter Verhelst wrote: [...] > I don't know about cmake; and scons and waf are both crap, so it's not > surprising they've not even heard of symbol versioning. I disagree, I think SCons and Waf (along with Gradle) make Make, CMake, Autotools, etc., etc. look like

Re: OSCON 2012 notes

2012-07-22 Thread Nick Sabalausky
On Sun, 22 Jul 2012 01:24 -0700 Jonathan M Davis wrote: > On Sunday, July 22, 2012 10:10:43 Paulo Pinto wrote: > > Am 22.07.2012 01:13, schrieb Nick Sabalausky: > > > On Sat, 21 Jul 2012 14:41:05 +0200 > > > > > > Paulo Pinto wrote: > > >> Regarding systems programming, Go could actually play i

Re: OSCON 2012 notes

2012-07-22 Thread Jonathan M Davis
On Sunday, July 22, 2012 10:10:43 Paulo Pinto wrote: > Am 22.07.2012 01:13, schrieb Nick Sabalausky: > > On Sat, 21 Jul 2012 14:41:05 +0200 > > > > Paulo Pinto wrote: > >> Regarding systems programming, Go could actually play in the same > >> league as D > > > > [...] > > > >> The trick with Ob

Re: OSCON 2012 notes

2012-07-22 Thread Paulo Pinto
Am 22.07.2012 01:13, schrieb Nick Sabalausky: On Sat, 21 Jul 2012 14:41:05 +0200 Paulo Pinto wrote: Regarding systems programming, Go could actually play in the same league as D [...] The trick with Oberon, which Go also uses, is to have a special module reckognised by the compiler with prim

Re: Optional name mangling

2012-07-22 Thread Walter Bright
On 7/21/2012 11:45 PM, Daniel Murphy wrote: The problem isn't that D is mangling names it shouldn't, the problem is that your import library uses the wrong mangling for the internal names of imported symbols. Using the .def file with implib is the correct solution, unless you want to try convert