www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DMD: Is it possible change compile time errors to runtime errors in

reply Marcone <marcone email.com> writes:
Is it possible change compile time errors to runtime errors in 
Dlang?
If yes, how can I make it?
Mar 05 2020
next sibling parent reply Mathias Lang <pro.mathias.lang gmail.com> writes:
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
 Is it possible change compile time errors to runtime errors in 
 Dlang?
 If yes, how can I make it?
No it's not possible, D is a statically typed language. Why would you want errors that can be caught at compile time to happen at runtimes ?
Mar 05 2020
parent reply Marcone <marcone email.com> writes:
On Friday, 6 March 2020 at 05:31:57 UTC, Mathias Lang wrote:
 On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
 Is it possible change compile time errors to runtime errors in 
 Dlang?
 If yes, how can I make it?
No it's not possible, D is a statically typed language. Why would you want errors that can be caught at compile time to happen at runtimes ?
I'm coming from Python
Mar 06 2020
next sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 3/6/20 8:59 AM, Marcone wrote:
 On Friday, 6 March 2020 at 05:31:57 UTC, Mathias Lang wrote:
 On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
 Is it possible change compile time errors to runtime errors in Dlang?
 If yes, how can I make it?
No it's not possible, D is a statically typed language. Why would you want errors that can be caught at compile time to happen at runtimes ?
I'm coming from Python
Perhaps you can share an example of your trouble, and we can explain why it's better to have compiler errors in that case. -Steve
Mar 06 2020
prev sibling parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 3/6/20 5:59 AM, Marcone wrote:> On Friday, 6 March 2020 at 05:31:57 
UTC, Mathias Lang wrote:

 I'm coming from Python
The fact that errors are delayed until run time is a Python deficiency. We accept that deficiency because we also accept claimed benefits that Python brings. If you want to skip the compilation step, you unfortunately can not, but you can combine compilation and execution steps with 'rdmd', which may make it look like the errors are caught at run time: https://dlang.org/rdmd.html Ali
Mar 06 2020
prev sibling parent Basile B. <b2.temp gmx.com> writes:
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote:
 Is it possible change compile time errors to runtime errors in 
 Dlang?
no
 If yes, how can I make it?
if you deactivate all the errors emitted during the semantic then there are very good chance that the compiler crashes while generating code.
Mar 06 2020