User loginNavigation |
LtU ForumInterfaces vs. Type ClassesI've recently been looking at a notion of interfaces for BitC. The language already has type classes in the style of Haskell, with all of the pros and cons of these. The deeper my dive into interfaces, the more confused I became about the difference between interfaces and type classes. This either means that I'm hopelessly confused or that I've stumbled into something useful. I'm sure the LtU audience can explain my confusion. :-) BitC has object-style methods in a syntactic sense, but no virtual methods or inheritance. In such a language, object methods are sugar. We also have a notion of interfaces, currently called "capsules". A capsule provides existential encapsulation of an underlying object combined with a known set of methods. In contrast to Java-style interfaces, a capsule type has an explicitly invocable constructor. This means that a capsule can have non-default instantiations for a given underlying type T. Capsule constructor arguments corresponding to method initializers are constrained to be compile-time evaluable. This has the consequence that every capsule "method table" is a compile-time constant in the same way that every type class instance method table is a compile-time constant. Capsules may have either static of conventional methods. A static is method does not receive or require a reference to the encapsulated object. The lifetime of a capsule instance is guaranteed not to exceed the lifetime of the object (if any) that it encapsulates. Q: How is a capsule type consisting exclusively of static methods different from a type class, if at all? MemorySharp - Managed library for memory editing, and Fasm.NET - Managed wrapper to use the FASM compiler from .NET applications(Obviously of possible interest for some language implementors) By Jämes Ménétrey (aka "ZenLulz") : MemorySharp MemorySharp is a C# based memory editing library targeting Windows applications, offering various functions to extract and inject data and codes into remote processes to allow interoperability. The goal of this library is to provide a safe, powerful and easy to use API, keeping the remote process as clean as possible. This library is said Out-of-Process, in other words it does not need to be injected within the target process. Only your application loads MemorySharp, ensuring that only the requested operations are executed in the opened process. For the moment, the library only supports 32-bit development. Home page: http://binarysharp.com/products/memorysharp/ Also on GitHub: https://github.com/ZenLulz/MemorySharp and on NuGet: http://www.nuget.org/packages/MemorySharp/ Fasm.NET A managed wrapper to use the FASM compiler from .NET applications. This library is written in C++/CLI and embeds FASM compiler as a linkable Microsoft COFF object. As FASM compiler is built in 32-bit, the managed assembly can only be used within a 32-bit development. The branches match with the current versions of FASM compiler as published on the official website. Home page: http://binarysharp.com/products/fasmnet/ Also on GitHub: https://github.com/ZenLulz/Fasm.NET and on NuGet: http://www.nuget.org/packages/Fasm.NET/ Licensing Both librairies come with the MIT license: * MemorySharp, since 9/14/2013 (Announcement) * Fasm.NET, as of v2.0.0 Excerpt from MemorySharp's feature list : Process interactions * Check if the process is debugged Memory interactions * Allocate and free a chunk of memory Module interactions * Enumerate all modules loaded Thread interactions * Create and terminate threads Window interactions * Enumerate the windows of the process Assembly interactions * Assemble mnemonics (... and more) Fasm.NET's feature list : * Assemble mnemonics on the fly ... (A few FASM links)
P.S. Happy new year 2014, everybody, "by the way" :) And a random fact, as of 01/01/2014: both the CLR and C# are still in their teenage, for just a couple more years to come... ;) Cheers, Different approaches to letting a programmer define interface implementations.I'm looking at how different statically typed languages tackle the problem of letting you define types and define interface implementations for those types. For example, to define an implementation of interface I for type T, Java uses interface methods, Haskell uses typeclasses, Scala uses implicits. The disadvantage of the Java approach when compared with Haskell/Scala:
Haskell approach vs Scala approach:
What do you think is the "right" way to do this? Given my limited knowledge right now, I think I'd go with something Scala-like and maybe make some modifications. For example, I think the "only one implementation per type" restriction of Haskell might be useful. Is there a good survey of the different approaches? Alternative implementation of closures in CSo I've been working on a new language for a while and the topic of how to implement closures came up. I have seen closures usually implemented on the heap or with some malloc region of memory. This seems suboptimal so I thought of it some more and came up with the idea of using type unions to store local variables. This way closures could be passed around on the stack normally. Obviously this has downsides if you hold too many local variables or few large ones. Since this has probably been done before, I would like to ask the community what their experiences have been with alternative closure implementations. Also to note, specialization of functions is an option that could help reign in the size of the closure struct. A usage poll for the Coq proof assistantCoq developpers recently put together a survey of their tool usage, which will hopefully inform future evolutions. From Matthieu Sozeau's announcement:
By gasche at 2013-12-29 01:07 | LtU Forum | login or register to post comments | other blogs | 3448 reads
A glimpse into a new general purpose programming language under development at MicrosoftMicrosoft's Joe Duffy and team have been (quietly) working on a new programming language, based on C# (for productivity, safety), but leveraging C++ features (for performance). I think it's fair to say - and agree with Joe - that a nirvana for a modern general purpose language would be one that satisfies high productivity (ease of use, intuitive, high level) AND guaranteed (type)safety AND high execution performance. As Joe outlines in his blog post (not video!): At a high level, I classify the language features into six primary categories: 1) Lifetime understanding. C++ has RAII, deterministic destruction, and efficient allocation of objects. C# and Java both coax developers into relying too heavily on the GC heap, and offers only “loose†support for deterministic destruction via IDisposable. Part of what my team does is regularly convert C# programs to this new language, and it’s not uncommon for us to encounter 30-50% time spent in GC. For servers, this kills throughput; for clients, it degrades the experience, by injecting latency into the interaction. We’ve stolen a page from C++ — in areas like rvalue references, move semantics, destruction, references / borrowing — and yet retained the necessary elements of safety, and merged them with ideas from functional languages. This allows us to aggressively stack allocate objects, deterministically destruct, and more. What do you think? John Shutt on "Abstractive Power"John has written a long and promising blog post on abstractive power.
I'll admit I haven't read it yet, but I'm very happy to see it and hope some of you may be as well -- I even dare to suspect that recent mentions of this topic here on LtU may have been one of the motivations for the large effort of John to write and release this document. Now for a hefty amount of reading, and then some programming language discussion! Inheritance is the Base Class of EvilI found this talk by Sean Parent to be very informative (and it's 24 minutes long). What do you think? Print release of a textbook on the Coq proof assistantFor a few years now, I've been working on a textbook introducing the Coq proof assistant. It's been available freely online, and I'd like to announce now the availability of a print version from MIT Press. The site I've linked to includes links to order the book online. Quick context on why LtUers might be interested in Coq: it supports machine checking of mathematical proofs, including in program verification and PL metatheory, some of the most popular applications of proof assistant technology. Quick context on what distinguishes this book from other Coq resources: it focuses on the engineering techniques to develop large formal developments effectively. It turns out that there are some reusable lessons on how to write formal proofs so that they tend to continue to work even when theorem statements change over the courses of projects. I'm grateful to MIT Press for agreeing to this experiment where I may continue distributing free versions of the book online. Its type checking, Jim, but not as we know it.A new completely rewritten and improved version of my previous Going Against the Flow paper. Abstract:
The main innovation in this work is a treatment of fields and assignment to support it. We have found that assignment between a term's fields is parametric with respect to the assignments of that term! Intuitive but semantically tricky. Soundness proof of this treatment is included in the paper, along with a feasible (but unproved) way of implementing it. Anyways, once that's done, we can model the entire type system in terms of assignments and fields, which I don't think has been done before. |
Browse archives
Active forum topics |
Recent comments
9 weeks 18 hours ago
9 weeks 1 day ago
9 weeks 1 day ago
9 weeks 2 days ago
9 weeks 5 days ago
9 weeks 5 days ago
9 weeks 6 days ago
9 weeks 6 days ago
9 weeks 6 days ago
9 weeks 6 days ago