User loginNavigation |
LtU ForumFP in D 2.0Andrei Alexandrescu describes (PDF) how to get safe functional programming in the otherwise imperative language D. vs., say, monads. What to do about comments?This question has been bugging me for a while: whats the standard practice of handling comments during parsing? Ignore them or annotate the parsetree? My first thought is to simply let the lexer discard comments. But if the goal is to reproduce the source of the program via a pretty printer or some such, the comments need to come a long for the ride? What leads me to this line of inquiry is: If I'm a client purchasing a parser should I expect my $20,000 C++ parser (for example, I've read C++ parsers are expensive) to preserve comments? Functional reactive programming in C# for WPFI've been working on a library to wrap WPF dependency properties with signals so that data binding is easier to do in WPF when using C#: http://www.codeplex.com/wpfsignals. Dependency properties by themselves are like signals (time-varying values) but don't support direct transformation (i.e., map) or composition like signals do. Instead, you have to define verbose value converters and jump through a lot of hoops. To solve this problem, the WPF signal library creates a signal-like wrapper around dependency properties so they can support direct transformation and composition; e.g., we can directly express relationships like: rectangle().top().bind = canvas.height() - rectangle.height() meaning that the rectangle is stuck to the bottom of the canvas, even as the size of the canvas or rectangle changes. This is currently a source code release only. SignalLib is a Visual Studio 2008 .NET 3.5 project, and an example application (in the SignalExample project) is provided to help introduce the library. Feedback is appreciated. Language/Interface for a 5-button deviceI'm going to be doing some traveling in the near future where I won't have my laptop available, but I'd still like to be able to play around with programming a bit. I have an MP3 player running the opensource firmware rockbox, and thought I could develop a plugin for it that would be a programming environment that would let me still code some toy programs relatively quickly despite the player only having 6 buttons. This presents some unique challenges. Ideas so far: -Keep naming things to a minimum (since typing variable names by selecting letters from a grid would be really burdensome). I'm thinking of just having a 'new variable' option that would give a variable with an autogenerated name (e.g. 'A1'), with the option to edit the name if things start to become too unreadable. -Programs are state machines. Press a button to make a state (also having autogenerated names, e.g. 'S1'). Each state has a set of button handlers and a particular screen graphic associated with it. Not necessarily scalable to large programs, but should be sufficient for small ones. This way switching what buttons should do and switching what's on screen involves just picking a state from a list. -Builtin functions to draw a grid of squares, iterate over all of them by row or by column, and the ability to associate state with each square. Squares will automatically have at least one character variable associated with them, and the value stored in it will be drawn inside the square. I think this would be enough to implement some simple board games like othello, and some toy programs like say a binary clock. But I'm curious if anyone else has ideas or has worked in a similar environment, say trying to make a programming IDE for a cell phone or other limited input device. Effectiveness of C++ for scientific computing?I know this question might have been asked before, but I haven't found any satisfactory answer as of yet. Is C++ effective as a language for scientific computing? How easy it is to create GUIs from simple command line programs in C++ compared to python? In python, I think TK can be used, but what are the steps to go about to do that in C++? And, in terms of speed, where does C++ stand compared to Numpy? I know that C would be faster, but what about C++? Systems programming in languages other than C?Simple question. What is the latest research into doing the sort of tasks usually done in C/C++ with something else? I'll list three areas I think are important. 1) Ability to interface directly with hardware (i.e. can you write an OS in it) I'm aware of OCaml, which seems to fulfill at least #2 and #3 and I know about the House project in Haskell. The latter seems not to have been worked on in about 2 years though. I also know about the D language which seems like a better C++ but not a real departure from what's been going on for 30+ years. More generally, is any significant research into radical new OS concepts going on and what sort of languages are they using? Multi-Artifact LanguagesLately I've been wondering about a trend in software development: We seem to be grappling not so much with algorithm specification, but rather with the organization of large systems developed by large teams. As such, documentation and testing become almost as relevant as the source code itself. I was wondering whether there were any good languages for writing (1) source code, (2) documentation, and (3) unit tests all in the same location, and in an elegant way? I'm thinking something like this:
(define (factorial n)
(returns "the mathematical factorial of n.")
(if (> n 0)
(* n (factorial (- n 1)))
1)
(such-that
(and (= (factorial 0) 1)
(= (factorial 5) 120))))
And it would translate into (1) a function that computed the factorial, (2) a unit test for that function, and (3) this documentation (or something similar): Factorial (n): Returns the mathematical factorial of n. Examples: Factorial (0) = 1 (passed), Factorial (5) = 120 (passed). My initial thought is that it would have to be some sort of Lisp-type macro system, but that's just a guess. Any thoughts would be appreciated. Easiest language to make binding for?I've been wrapping a C++ library of mine using Python and have been finding it all quite challenging. One complexity is that I'm using SWIG and my wrappers use objects that are themselves written in C++ and wrapped using SIP and something else too (I think it's called Dart). Apparently all wrapped Python objects are not truly the same in their meta-data and you need to screw around with different ways to extract the pointer to the original C/C++ objects. Anyway, I was wondering what language people thought was the easiest to construct wrappers around compiled (presumably C/C++) code in. I'll consider any paradigm, functional, imperative, OO/non-OO, whatever. Practical Bits of Making a Compiler for a New LanguageI'm designing (and hopefully implementing) a new programming language. Now, I've taken a bit of language-design advice I once heard from a wise old professor, which is: "Never add an entirely new feature to an entirely new language." Instead, I'm consolidating older, thoroughly-tested ideas whose time has come into a language suited for a domain that has yet to see such features. The vision? An advanced, almost-type-safe imperative language with functional and object-oriented features for kernel and base-library level systems programming. The goal in creating this? To bring the convenience of high-level language features to low-level programming. The very foundation of the language is: 1) Lexical scoping. The features I'm putting in are: 1) Module/unit files. See: Delphi, Python. Features left out as deliberate design decisions are: Now, the things I need your advice about are: I've got a textbook on compilation techniques and I'm raring to go at this, so please write in any ideas or criticisms you might have. Except about the mandate of garbage collection. I refuse to have my thread scheduler pause for a GC, though I feel quite happy about having one for writing desktop applications. Ada, the Ultimate Lambda?Chris Oakasaki has a blog post about teaching functional programming using Ada. He says
The idea of crossing paradigms has been around awhile. SICP rather famously introduces object orientation by building it on top of Scheme. What do you think about teaching or learning paradigm A in a language strongly oriented towards paradigm B? What's gained? What's lost? |
Browse archives
Active forum topics |
Recent comments
8 weeks 1 day ago
8 weeks 1 day ago
8 weeks 2 days ago
8 weeks 3 days ago
8 weeks 6 days ago
8 weeks 6 days ago
9 weeks 14 hours ago
9 weeks 18 hours ago
9 weeks 19 hours ago
9 weeks 19 hours ago