April 16, 2005
TechnoZeus wrote:
> "Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in message news:m5d4j2-g75.ln1@lnews.kuehne.cn...
> 
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>TechnoZeus schrieb am Thu, 14 Apr 2005 16:12:44 -0500:
>>
>>>Okay, you wanted an example?
>>>
>>>version (Windows)
>>>{
>>> MessageBoxA(null,"click OK to continue","message_box",MB_OK);
>>>}
>>>
>>>save as pausok.d and compile with
>>>DMD pausok
>>>
>>>In the current version, that wouldn't even compile... but it wouldn't take a
>>>lot of changes to make it so that it would.
>>
>><snip>
>>
>>Anyone care to demonstrate that by patching GDC?
>>
>>Thomas
>>
>>
> 
> 
> That would be great.  I would, if I had the time, but I'm doing all I can as it is just to be involved in here at all.
> 
> By the way, I found a good example at file:///F:/dmd/html/d/sdwest/page1.html
> 
> <quote>
> 
> int main()
> {
>   printf("hello world\n");
>   return 0;
> }
> 
> </quote>
> 
> Notice that there is no "..." anywhere indicating snipped or missing lines.  It is presented as a complete, working "Hello World" program... but it won't compile, because even though most D programmers probably already know from C what needs to be imported or included to make it work, the DMD compiler doesn't.
> 
> TZ

The "magic" here is that D automatically imports object.d. If it were desirable (and I don't think it is), we could import the kitchen sink through object.d and we wouldn't need to use import for any of the standard library.

Several of us have been trying to convince Walter for months that the printf should be removed from object.d. I think it's reasonable to expect that the programmer will request printf explicitly with an import.


-- 
jcc7
http://jcc_7.tripod.com/d/
April 16, 2005
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> [cross post & followup to digitalmars.D.bugs]
> 
> TechnoZeus schrieb am Thu, 14 Apr 2005 16:12:44 -0500:
> 
>>You tested what? I'm not talking about long filenaes support in the language here.
>>I'm talking about the Digital Mars D compiler itself.  Sorry it I was ambiguous.
>>Try compiling a file named longfilename.d and you will get an error to the
>>effect of "C:\DM\TEST\LONGFI~1.D: module LONGFI~1 has non-identifier
>>characters in filename, use module declaration instead".
>>
>>At least, that's what happens in Windows 98.  Maybe on another operating
>>system this is not the case.  The inability to compile at all is probably
>>the "~" character being used in the MS_DOS short filename that Windows is
>>automatically generated by the operating system for the benefit of programs
>>that only support <= 8 character long filenames with <= 3 character
>>extensions.  The DMD compiler apears to be one of those programs.  
> 
> 
> Seems to be Windows specific.
> 
> Thomas

It's likely a Windows 98-specific problem. I haven't run into this particular problem on XP (I have a "hello_world.d" that works fine for me). I suspect that Windows 2000 and Windows ME are also immune though I'm not sure that I've checked them.

-- 
jcc7
http://jcc_7.tripod.com/d/
April 19, 2005
This misses my point though.  Rather than having just one big import that's automatic whether you use it or not, I am suggesting that there be many commonly used items be listed as "automatic if needed" so that no action needs to be done to import the file containing that item other than to try to use the item without first creating the item or explicitly importing the item.  In other words, if it's unknown... check the list.  If it's unknown and in the list... import it.

TZ


"J C Calvarese" <jcc7@cox.net> wrote in message news:d3q46v$1qrh$1@digitaldaemon.com...
> TechnoZeus wrote:
> > "Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in message news:m5d4j2-g75.ln1@lnews.kuehne.cn...
> >
> >>-----BEGIN PGP SIGNED MESSAGE-----
> >>Hash: SHA1
> >>
> >>TechnoZeus schrieb am Thu, 14 Apr 2005 16:12:44 -0500:
> >>
> >>>Okay, you wanted an example?
> >>>
> >>>version (Windows)
> >>>{
> >>> MessageBoxA(null,"click OK to continue","message_box",MB_OK);
> >>>}
> >>>
> >>>save as pausok.d and compile with
> >>>DMD pausok
> >>>
> >>>In the current version, that wouldn't even compile... but it wouldn't take a lot of changes to make it so that it would.
> >>
> >><snip>
> >>
> >>Anyone care to demonstrate that by patching GDC?
> >>
> >>Thomas
> >>
> >>
> >
> >
> > That would be great.  I would, if I had the time, but I'm doing all I can as it is just to be involved in here at all.
> >
> > By the way, I found a good example at file:///F:/dmd/html/d/sdwest/page1.html
> >
> > <quote>
> >
> > int main()
> > {
> >   printf("hello world\n");
> >   return 0;
> > }
> >
> > </quote>
> >
> > Notice that there is no "..." anywhere indicating snipped or missing lines.  It is presented as a complete, working "Hello World" program... but it won't compile, because even though most D programmers probably already know from C what needs to be imported or included to make it work, the DMD compiler doesn't.
> >
> > TZ
>
> The "magic" here is that D automatically imports object.d. If it were desirable (and I don't think it is), we could import the kitchen sink through object.d and we wouldn't need to use import for any of the standard library.
>
> Several of us have been trying to convince Walter for months that the printf should be removed from object.d. I think it's reasonable to expect that the programmer will request printf explicitly with an import.
>
>
> -- 
> jcc7
> http://jcc_7.tripod.com/d/


April 19, 2005

TechnoZeus wrote:
> This misses my point though.  Rather than having just one big import
> that's automatic whether you use it or not, I am suggesting that
> there be many commonly used items be listed as "automatic if needed"
> so that no action needs to be done to import the file containing that
> item other than to try to use the item without first creating the
> item or explicitly importing the item.  In other words, if it's
> unknown... check the list.  If it's unknown and in the list... import
> it.

This guy is starting to make sense. If we have "Standard Libraries" in D, then it is not entirely too far-fetced to automate the inclusion of them -- in "regular programs".

> "J C Calvarese" <jcc7@cox.net> wrote in message
> news:d3q46v$1qrh$1@digitaldaemon.com...
> 
>> TechnoZeus wrote:
>> 
>>> "Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in
>>> message news:m5d4j2-g75.ln1@lnews.kuehne.cn...
>>> 
>>> 
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>> 
>>>> TechnoZeus schrieb am Thu, 14 Apr 2005 16:12:44 -0500:
>>>> 
>>>> 
>>>>> Okay, you wanted an example?
>>>>> 
>>>>> version (Windows) { MessageBoxA(null,"click OK to
>>>>> continue","message_box",MB_OK); }
>>>>> 
>>>>> save as pausok.d and compile with DMD pausok
>>>>> 
>>>>> In the current version, that wouldn't even compile... but it
>>>>> wouldn't take a lot of changes to make it so that it would.
>>>> 
>>>> <snip>
>>>> 
>>>> Anyone care to demonstrate that by patching GDC?
>>>> 
>>>> Thomas
>>>> 
>>>> 
>>> 
>>> 
>>> That would be great.  I would, if I had the time, but I'm doing
>>> all I can as it is just to be involved in here at all.
>>> 
>>> By the way, I found a good example at
>>> file:///F:/dmd/html/d/sdwest/page1.html
>>> 
>>> <quote>
>>> 
>>> int main() { printf("hello world\n"); return 0; }
>>> 
>>> </quote>
>>> 
>>> Notice that there is no "..." anywhere indicating snipped or
>>> missing lines.  It is presented as a complete, working "Hello
>>> World" program... but it won't compile, because even though most
>>> D programmers probably already know from C what needs to be
>>> imported or included to make it work, the DMD compiler doesn't.
>>> 
>>> TZ
>> 
>> The "magic" here is that D automatically imports object.d. If it
>> were desirable (and I don't think it is), we could import the
>> kitchen sink through object.d and we wouldn't need to use import
>> for any of the standard library.
>> 
>> Several of us have been trying to convince Walter for months that
>> the printf should be removed from object.d. I think it's reasonable
>> to expect that the programmer will request printf explicitly with
>> an import.

Printf _should_ be removed from the language _entirely_. If someone wants to use it, then let him import (ehh, something like) std.c.stdio, or whatever.

What's the point of bragging with a smoother and more consistent language, if at the same time something as arcane as printf is imported by default??
April 19, 2005
TechnoZeus wrote:
> This misses my point though.  Rather than having just one big import
> that's automatic whether you use it or not, I am suggesting that
> there be many commonly used items be listed as "automatic if needed"

The more I think about this, the more I find it difficult to oppose it.

I do, however, also see a lot of specters and demons rising up the wall.

How would this combine with the "(compiler or linker) skip what's not actually used"?

OTOH, if this falls in the same category as "why should you write a Main Procedure, if all you do is a bunch of commands in series", then I'd oppose to this, vehemently. (I.e. there needs to be a more valid reason for "automatic imports", whether they mean only Phobos, or imports in general.)
April 19, 2005
On Wed, 20 Apr 2005 01:36:31 +0300, Georg Wrede wrote:

> TechnoZeus wrote:
>> This misses my point though.  Rather than having just one big import that's automatic whether you use it or not, I am suggesting that there be many commonly used items be listed as "automatic if needed" so that no action needs to be done to import the file containing that item other than to try to use the item without first creating the item or explicitly importing the item.  In other words, if it's unknown... check the list.  If it's unknown and in the list... import it.
> 
> This guy is starting to make sense. If we have "Standard Libraries" in D, then it is not entirely too far-fetced to automate the inclusion of them -- in "regular programs".

Funny you should say this...I'm currently putting this sort of thing into
my Build utility.


[snip]

> Printf _should_ be removed from the language _entirely_. If someone wants to use it, then let him import (ehh, something like) std.c.stdio, or whatever.
> 
> What's the point of bragging with a smoother and more consistent language, if at the same time something as arcane as printf is imported by default??

Gets my vote!

-- 
Derek
Melbourne, Australia
20/04/2005 9:14:44 AM
April 20, 2005
Ah, finally... someone understood me.  Thank you!  :)

TZ

"Georg Wrede" <georg.wrede@nospam.org> wrote in message news:426587EF.3000808@nospam.org...
>
>
> TechnoZeus wrote:
> > This misses my point though.  Rather than having just one big import that's automatic whether you use it or not, I am suggesting that there be many commonly used items be listed as "automatic if needed" so that no action needs to be done to import the file containing that item other than to try to use the item without first creating the item or explicitly importing the item.  In other words, if it's unknown... check the list.  If it's unknown and in the list... import it.
>
> This guy is starting to make sense. If we have "Standard Libraries" in D, then it is not entirely too far-fetced to automate the inclusion of them -- in "regular programs".
>
> > "J C Calvarese" <jcc7@cox.net> wrote in message news:d3q46v$1qrh$1@digitaldaemon.com...
> >
> >> TechnoZeus wrote:
> >>
> >>> "Thomas Kuehne" <thomas-dloop@kuehne.thisisspam.cn> wrote in message news:m5d4j2-g75.ln1@lnews.kuehne.cn...
> >>>
> >>>
> >>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
> >>>>
> >>>> TechnoZeus schrieb am Thu, 14 Apr 2005 16:12:44 -0500:
> >>>>
> >>>>
> >>>>> Okay, you wanted an example?
> >>>>>
> >>>>> version (Windows) { MessageBoxA(null,"click OK to
> >>>>> continue","message_box",MB_OK); }
> >>>>>
> >>>>> save as pausok.d and compile with DMD pausok
> >>>>>
> >>>>> In the current version, that wouldn't even compile... but it wouldn't take a lot of changes to make it so that it would.
> >>>>
> >>>> <snip>
> >>>>
> >>>> Anyone care to demonstrate that by patching GDC?
> >>>>
> >>>> Thomas
> >>>>
> >>>>
> >>>
> >>>
> >>> That would be great.  I would, if I had the time, but I'm doing all I can as it is just to be involved in here at all.
> >>>
> >>> By the way, I found a good example at file:///F:/dmd/html/d/sdwest/page1.html
> >>>
> >>> <quote>
> >>>
> >>> int main() { printf("hello world\n"); return 0; }
> >>>
> >>> </quote>
> >>>
> >>> Notice that there is no "..." anywhere indicating snipped or missing lines.  It is presented as a complete, working "Hello World" program... but it won't compile, because even though most D programmers probably already know from C what needs to be imported or included to make it work, the DMD compiler doesn't.
> >>>
> >>> TZ
> >>
> >> The "magic" here is that D automatically imports object.d. If it were desirable (and I don't think it is), we could import the kitchen sink through object.d and we wouldn't need to use import for any of the standard library.
> >>
> >> Several of us have been trying to convince Walter for months that the printf should be removed from object.d. I think it's reasonable to expect that the programmer will request printf explicitly with an import.
>
> Printf _should_ be removed from the language _entirely_. If someone wants to use it, then let him import (ehh, something like) std.c.stdio, or whatever.
>
> What's the point of bragging with a smoother and more consistent language, if at the same time something as arcane as printf is imported by default??


April 20, 2005
"Georg Wrede" <georg.wrede@nospam.org> wrote in message news:42658940.9080500@nospam.org...
> TechnoZeus wrote:
> > This misses my point though.  Rather than having just one big import that's automatic whether you use it or not, I am suggesting that there be many commonly used items be listed as "automatic if needed"
>
> The more I think about this, the more I find it difficult to oppose it.
>
> I do, however, also see a lot of specters and demons rising up the wall.
>
> How would this combine with the "(compiler or linker) skip what's not
> actually used"?
>
> OTOH, if this falls in the same category as "why should you write a Main Procedure, if all you do is a bunch of commands in series", then I'd oppose to this, vehemently. (I.e. there needs to be a more valid reason for "automatic imports", whether they mean only Phobos, or imports in general.)

Simple... If it's not called, don't implicitly import it.  If it's not imported... there's nothing to skip.

Unfortunately, I think you still don't understand my reasoning behind the idea of not "requiring" superflous code such as a "main" function declaration, but that's probably just because it's not something you have ever seen any use for... and I don't think it would be easy for me to get around your inability to see past what you have no experience with... but anyway, that I idea and the concept of implicit imports are entirely independant of each other.

TZ


April 20, 2005
TechnoZeus wrote:

> Unfortunately, I think you still don't understand my reasoning behind
> the idea of not "requiring" superflous code such as a "main" function
> declaration, but that's probably just because it's not something you
> have ever seen any use for... and I don't think it would be easy for
> me to get around your inability to see past what you have no
> experience with... but anyway, that I idea and the concept of
> implicit imports are entirely independant of each other.

I guess I don't.

All I can say is, I started with Fortran, then went to Basic (on Commodore VIC-20, Kaypro-II CP/M, then GW-Basic on MS-DOS.

Then I switched to Turbo Pascal, around 1983. (At that time I also got my first computer job, as the operator of a unix machine (Data General 16-user Super Micro, running DG-AOS).)

When I started with Pascal, I did feel that it's a chore to write

  program myprog;

  uses crt;

  const
    myconst = 37;

  var
    myvar1, myvar2 : Integer;

  begin
    {start writing here}

  end.

just to get even started to program anything. But I got used to it. Then I wrote C, C++ and Java progs, and all of them required "superfluous crap" to be written before you come to your own stuff.

But then I realized that this is just an illusion. It looks like a chore when you do 5-line programs. There the "obligatory crap" outnumbers "your own" code. But as soon as you get to 50 lines (a paper page), this superfluos stuff just diminishes out of sight. And when you write 10000 line programs, you don't even notice.

Today, I also use languages where you don't "need to do the crap". Shell scripts, Perl, Euphoria. It's "your own code" all the way, and no "crap".

But you're right: I don't see your point.

Maybe you should explain it "like to a child", slow and precisely. I may not even be the only one who has a hard time understanding your point.

(And yes, this and the implicit imports are separate issues.)
April 20, 2005
But that is exactly my point...
If you don't even notice it, then it is obviously of no importance to you.
What is important, you notice.

For example, if you want your main function to take in a single integer argument rather than the usual array or arrays of characters,
then you will "want" to write your main function accordingly.
If you don't even care whether or not you "have" a "main" function,
or what it's called,
then why should you have to type it at all?

Yes, I agree that in larger programs those few extra lines don't ammount to much...
but I also realize that as long as they are "required" nobody can start programming without them.
This means that rather than being able to look at any existing program and pick out one line to learn the meaning of,
it becomes necessary for the beginning programmer to find useless programs to learn from,
that exist only for the purpose of showing newbies the minimum amount of un-needed junk necessary to begin programming.
This means that their first lessons in programming are first to plagiarize someone else's junk (litterally) and second, to ignore it rather than understand it.
Not good lessons to start a newbie off with.

TZ


"Georg Wrede" <georg.wrede@nospam.org> wrote in message news:426624DC.6030309@nospam.org...
> TechnoZeus wrote:
>
> > Unfortunately, I think you still don't understand my reasoning behind the idea of not "requiring" superflous code such as a "main" function declaration, but that's probably just because it's not something you have ever seen any use for... and I don't think it would be easy for me to get around your inability to see past what you have no experience with... but anyway, that I idea and the concept of implicit imports are entirely independant of each other.
>
> I guess I don't.
>
> All I can say is, I started with Fortran, then went to Basic (on Commodore VIC-20, Kaypro-II CP/M, then GW-Basic on MS-DOS.
>
> Then I switched to Turbo Pascal, around 1983. (At that time I also got
> my first computer job, as the operator of a unix machine (Data General
> 16-user Super Micro, running DG-AOS).)
>
> When I started with Pascal, I did feel that it's a chore to write
>
>    program myprog;
>
>    uses crt;
>
>    const
>      myconst = 37;
>
>    var
>      myvar1, myvar2 : Integer;
>
>    begin
>      {start writing here}
>
>    end.
>
> just to get even started to program anything. But I got used to it. Then I wrote C, C++ and Java progs, and all of them required "superfluous crap" to be written before you come to your own stuff.
>
> But then I realized that this is just an illusion. It looks like a chore when you do 5-line programs. There the "obligatory crap" outnumbers "your own" code. But as soon as you get to 50 lines (a paper page), this superfluos stuff just diminishes out of sight. And when you write 10000 line programs, you don't even notice.
>
> Today, I also use languages where you don't "need to do the crap". Shell scripts, Perl, Euphoria. It's "your own code" all the way, and no "crap".
>
> But you're right: I don't see your point.
>
> Maybe you should explain it "like to a child", slow and precisely. I may not even be the only one who has a hard time understanding your point.
>
> (And yes, this and the implicit imports are separate issues.)