Relative Content

Tag Archive for language-agnostic

Writing an API that is syntactically valid in multiple programming languages

I’m planning to write a single API that is syntactically valid in most major programming languages (to the greatest extent possible, so that only minimal amounts of code will need to be re-written when moving from one language to another). I think the simplest way to do this would be to write a group of functions that consisted entirely of function calls and variable assignments, since the syntax for function calls is almost exactly the same in all major programming languages.

Should I use a formal grammar for my interpreted scripting language

I have a scripting engine I just published as an open source project. It’s been sitting on my harddrive waiting for about a year. My engine of course isn’t complete in any way, but it does work for simple scripts. It has a javascript-ish feel to it, but I don’t wish to abide by the ECMA spec or anything.

How do I tell a user that bps means bits per second or bytes per second?

I’m writing an application that deals with the network and the hard drive. For the network portion, the application measures in bits per second, while the disk portion measures in bytes per second. This becomes an issue as they both are abbreviated b/s or bps everywhere I’ve seen. How could I inform the user that one means bits per second, while the other means bytes per second?

Best practice to sort then reverse, or write “backwards” comparator?

I wrote a comparator for a custom class of mine and when I ran my code I realised the output of my list of these objects was in the reverse order as to what I wanted. It was “ascending” as opposed to “descending”. This was because I stuck to the spec of compare where a return value of less than 0 means the other object is less than this and so on.

Dependency injection and ease of use

I’m writing a handy library (we’ll call it Thinger) that goes off and fetches an XML document, does some X-Path query on it and does something helpful with the result of that. (What I’m actually doing is far too boring to bother you all with, this is just a simplified example.)

Dependency injection and ease of use

I’m writing a handy library (we’ll call it Thinger) that goes off and fetches an XML document, does some X-Path query on it and does something helpful with the result of that. (What I’m actually doing is far too boring to bother you all with, this is just a simplified example.)