Talk:Postcondition

Would it make sense to merge postcondition and precondition? --Abdull 13:00, 2 August 2006 (UTC)Reply

Talk:Postcondition

Would it make sense to merge postcondition and precondition? --Abdull 13:00, 2 August 2006 (UTC)Reply

I think it makes no sense to put "result must be an integer" in the post-condition. It is not dynamically testable by an assertion and the type system will guarantee it anyway. Ian Bayley

It's a perfectly fine for an example, and might even sense for a weakly typed language which may not have an explicit integer type (like Javascript). Why would it not be dynamically testable? If (result != Integer(result)) then it probably means the result is larger than can be stored as an integer (or alternatively the result is outside the integer bounds of its floating-point representation) and will likely cause problems later on. Good reason to use the postcondition! 198.175.154.212 (talk) 15:59, 29 November 2010 (UTC)Reply
It is absolutely a necessary postcondition. In a language such as Javascript, I frequently set preconditions/postcondition that the argument/return value satisfy my isNumeric function. In other languages, it's just a coincidence that you can generally interpret as an integer any returned result (because the return result is likely a single word, which is likely the size of the basic integer type, which is likely non-nullable/non-NaN-able). However, even with a statically-typed language this isn't necessarily the case (e.g. if you're using a nullable number type or a not-necessarily-integer type such as floating point). Brian Geppert (talk) 15:44, 24 May 2011 (UTC)Reply

I I think it makes sense to put "result must be an integer" in the post-condition. —Preceding unsigned comment added by 203.196.189.130 (talk) 06:52, 19 May 2011 (UTC)Reply

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.