Language design - verbose-sharp
I’ve always wanted to get into a bit of programming language design. The languages I use today are too terse, too hard to understand. In my frustrations I’ve begun designing some syntax that is much more clear and useful and prevents many runtime errors.
Working with numbers directly is always dangerous, so we should work with them as strings:
Math.Divide(StringToNumber(”ten”),StringToNumber(”five”))
It goes without saying that the reverse should be impossible - 5/10 - because fractions can lose their precision in any number of ways thus causing unexpected runtime errors.
Working with numbers over 10 risk the chance of overflow; that’s why you can only represent these large numbers (>10) through safe operations, and not explicitly. So to get 80, you can’t just write StringToNumber(”eighty”). That would be madness. Instead, use multiplication:
// representation for 80:
var b = Math.Multiply(StringToNumber(”eight”),StringToNumber(”ten”))
Suppose we want to print our fancy number 80? With my language it’s trivial-
Systems.OutputSystems.ConsoleSystems.Output.WriteStream(ConvertStringToStream(b) , PositionOnScreen.CENTER)
Brilliant. I call it verbose#.
No Comments »
No comments yet.
Leave a comment