View mode: basic / threaded / horizontal-split · Log in · Help
July 20, 2005
other keywords[as,throw]
D is great but i ask if you can add these key words [as,throws]
[as] as in delphi make a checked typecast [objref as classref]
and [throws] as in java with which we can raise an exception 
very easily in java methods
thanks in advance

kortex
July 20, 2005
Re: other keywords[as,throw]
In article <dbmlp5$126u$1@digitaldaemon.com>, cortigenb6@yahoo.com says...
>
>D is great but i ask if you can add these key words [as,throws]
>[as] as in delphi make a checked typecast [objref as classref]

If Delphi's "as" is like C#'s, returning null for a bad cast, that's how D casts
work already.

>and [throws] as in java with which we can raise an exception 
>very easily in java methods

"throw" is already a D keyword and raises an exception. "throws" is something
quite different - it's in Java to support exception specifications, which are
now generally acknowledged to have been a bad idea.

cheers
Mike
July 24, 2005
Re: other keywords[as,throw]
thanks Mike
but why i want these keywords?!!! because i am a javanese man
and i really want to tranform a lot of java codes to d 
and im thinking for something like awt,swing for java
so deficient keywords like [throws ,instanceof,boolean]
make my dream a nightmare
i know with [D] we can do every thing as we like but as 
a lazy javanese programmer i need these keywords to make
my life easy and make me smile again
July 24, 2005
Re: other keywords[as,throw]
In article <dbum4n$19l5$1@digitaldaemon.com>, cortigenb6@yahoo.com says...
>
>thanks Mike
>but why i want these keywords?!!! because i am a javanese man
>and i really want to tranform a lot of java codes to d 
>and im thinking for something like awt,swing for java

AWT, Swing?? And that's your only problem? Man, good luck ...


>so deficient keywords like [throws ,instanceof,boolean]

They are not "deficient", they are missing - so what?.

- boolean is bool (or bit),
- "if (o instanceof x)"  is  "if (cast(x) o)"
- throw is throw
- throws: just drop it from the method signature, D has no checked exceptions.
(For what it's worth I'm also 'javanese' and I principally like the 
concept of checked exceptions, but the Java API has just gone overboard
with these in too many spots - 'javax.transaction.UserTransaction' any one?)
At least, I don't see how that will hinder you from from converting Java 
sources to D.
- "as" has never been a Java 'keyword' (or something else recognized by javac).


>make my dream a nightmare
>i know with [D] we can do every thing as we like but as 
>a lazy javanese programmer i need these keywords to make
>my life easy and make me smile again
>

Well, you're perhaps just too lazy ;-). Your "missing keywords" will very
likely be the least problem when you're going to convert Java sources to
D - most of them could be handled by simple string replacement or a slightly
more advanced regexp algorithm.

So I'd say: Wake up, D is not Java! You'll have to do some work on your own.

Best regards,
Stefan
July 25, 2005
Re: other keywords[as,throw]
Stefan wrote:
> In article <dbum4n$19l5$1@digitaldaemon.com>, cortigenb6@yahoo.com says...
>>make my dream a nightmare
>>i know with [D] we can do every thing as we like but as 
>>a lazy javanese programmer i need these keywords to make
>>my life easy and make me smile again
>>
> 
> 
> Well, you're perhaps just too lazy ;-). Your "missing keywords" will very
> likely be the least problem when you're going to convert Java sources to
> D - most of them could be handled by simple string replacement or a slightly
> more advanced regexp algorithm.
> 
> So I'd say: Wake up, D is not Java! You'll have to do some work on your own.
> 
> Best regards,
> Stefan
> 

I remember someone was writing a tool to convert java code to d.
I also remember that inner classes were speically added to d to ease 
that task.
Top | Discussion index | About this forum | D home