r/ProgrammingLanguages • u/levodelellis • Feb 08 '26
Languages with strong pre/post conditions?
I had some random thoughts. I have class where if I call setThing(N); another function (process) will return an array with at minimum (or exactly) N elements. Is that expressible in any languages?
I always though D pre/post/invariant was interesting. I know ada and spark has more (I plan to look at spark). Is there any languages that can express process returning Array [n] where n is the parameter of setThing? What languages should I look at if I'm interested in contract programming?
I'll likely keep a list of ideas and try to figure it out when I want to implement another programming language
View all comments
Show parent comment
1
u/Relevant_South_1842 Feb 26 '26
Can you show a syntax example in pseudo code? Would this be useful in a dynamic language?