Re: D on quora ...

2017-10-16 Thread Adam Wilson via Digitalmars-d

On 10/15/17 22:20, Dmitry Olshansky wrote:

On Sunday, 15 October 2017 at 20:24:02 UTC, Adam Wilson wrote:

database access (MySQL, PostgreSQL, Aerospike) libraries are available,


That is important actually.



So important that it should be a Priority 0 Must Have.


Luckily it should also be quite strightforward to write them. At minimum
there would be a C, Go, Java and Python “driver” to look at.

Also surprisingly, D has superior driver for MySQL that talks native
binary protocol while most other languages use the text mode.



The most important SQL DB's all have high quality C libraries. Why not 
leverage those? I don't understand the obsession with having everything 
written in native D. To be bluntly honest, I find the VisualD suffers 
greatly from not being written as a C# MEF component (Visual Studio's 
plugin system). There is no demonstrable advantage to writing an IDE 
plugin in D (as opposed to using the native language of the IDE) other 
than proving that it can be done.


Also, I would caution that MSFT is working *very* hard to retire the COM 
based plugin system for Visual Studio (here is the direction they are 
heading: https://github.com/dotnet/project-system). Honestly we could 
probably knock together an integrated D plugin based on Common Project 
System fairly quickly, but we'd have to do it in C#. Technically you 
could write a P/Invoke wrapper out to D, but ... why?



preferably as a standard library (like in Dart and Go).


Can’t do that. And it’s not standard in Go and Dart but packages, dub
should work for that.



I've been thinking about this question a LOT, and I'm not convinced
it's impossible to put the DB libs into the standard


Problem is - the development of std has glacial pace. Even if you put
say Aerospike in std, I don’t think it’s in our best interest to have
stagnated DB libs. DBs add features and ship new versions all the time.

What might work is JDBC style approach - having a common interface in
std with implementations in 3rd party. SQL might work this way.



I've been (slowly) working on exactly this. I started with a concept 
loosely based on ADO.NET but lately it's more D idiomatic than that.


Also, because SQL is what it is (a text based query language) it would 
actually be possible to include reference implementations of the major 
DB vendors for the common interface. (MySQL, PgSQL, etc.)



NoSQL though is highly irregular and benefits primarily from features
unique to a particular vendor.



Completely agree. However, some types of NoSQL DB's could be hidden 
behind generic interfaces, for example key-value stores.


--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


Re: D on quora ...

2017-10-16 Thread Adam Wilson via Digitalmars-d

On 10/15/17 13:40, Laeeth Isharc wrote:

On Saturday, 14 October 2017 at 22:43:33 UTC, Adam Wilson wrote:

On 10/7/17 14:08, Laeeth Isharc wrote:




In a polyglot environment, D's code generation and introspection
abilities might be quite valuable if it allows you to write core
building blocks once and call them from other languages without too much
boilerplate and bloat.  One could use SWIG, but...


Oh dear, I seem to have accidentally set off a firestorm.

Personally, I think there are better places to focus our energy than
worrying about what the users of other languages think. We like D,
that should be enough for us. The last line was somewhat
tongue-in-cheek. There is no way we're going to convert C#/Java users
either, and unlike C/C++ we cannot easily inter-operate with them.


If we can convert Pascal users, why won't some C# and Java programmers
be receptive to D?  Plenty of people have approached D from Java:



Indeed. I am an example of just such a convert (from C#). :) But it is 
much more difficult to inter-operate. The easiest path that I can see is 
Micro-services. Hide your different languages behind a REST API, such 
that your components are not talking C#<->D anymore, but HTTP<->HTTP. 
Then the language matters a LOT less, then you can convert individual 
services to a new language whenever business needs dictate.



https://dlang.org/blog/2017/09/06/the-evolution-of-the-accessors-library/
https://dlang.org/blog/2017/08/11/on-tilix-and-d-an-interview-with-gerald-nunn/

https://github.com/intellij-dlanguage/intellij-dlanguage/
(Kingsley came from Java).

Why can't we easily interop with Java and C#?  I didn't find interop
with Java so bad for what I was doing (embedding a Java library via the
JVM with callbacks to D code), and Andy Smith found similar.

http://dconf.org/2015/talks/smith.pdf
(towards the end)

C# interop for what I am doing sees easy enough.  (I will generate C#
wrappers for D structs and functions/methods).

This work wasn't open-sourced, and nor did Microsoft send out a press
release about their use of D in the COM team.  But I spoke to the author
in Berlin (maybe you did too), and it wasn't so much work to make it
useful:

http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf



Very cool. I had no idea MSFT was doing that. I didn't talk to him, but 
I was fighting a bad cold at DConf this year. :( I avoided talking to a 
lot of people.


Even so, I was more commenting on the fact that D has built in support 
for inter-operating with C/C++. It's not that it's impossible to 
inter-operate with C#/Java/etc., but it is significantly more work. And 
that can be a significant barrier to conversion when the ecosystem they 
are coming from comfortably provides everything they need already. :)





Instead of worrying about how to get more people to come from a
specific language. People will come if they see an advantage in D so
lets try to provide as many advantages as possible. :)


Yes - agree with this.




--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


Re: My first experience as a D Newbie

2017-10-16 Thread Rion via Digitalmars-d

On Sunday, 15 October 2017 at 20:27:35 UTC, Laeeth Isharc wrote:

D is much less gratifying than other languages for most people.
 Just like Windows was more gratifying than Linux for most 
people in 2000.  And I suppose that's likely to change slowly, 
but continue to be the case for a while so long as people 
working on Windows don't notice when something isn't working 
and fix things at root cause.  It's usually not that much more 
difficult to do so than work around it, and it usually pays off 
even considered selfishly.


I can appreciate your frustration, but considering how many 
years knowing a programming language can pay off for, a few 
hundred hours spent to learn something new isn't that much.  
That's like a couple of months full-time and if it works out 
the payback period should easily be a year.  Viewed rationally, 
that's a pretty good return on investment compared to most 
other opportunities available.


In a world where there are lots of smart people and knowledge 
is widely available, the barriers to opportunity (there must be 
barriers, otherwise the opportunity would be competed away) are 
often emotional ones.  So I like things where the difficulty is 
front-loaded, because they tend to be neglected by modern 
people who are used to quick gratification.  And whilst it 
surely can be frustrating, the situation is already better both 
on Windows and as regards documentation and tooling than it was 
in 2014.  It's not difficult to make little changes towards 
what one would like to see oneself.


When you invest this time into a language, you have expectations. 
A person expects for a language this old, that every puzzle fits 
together without issue.


Call me spoiled if you want but quick gratification it is not. 
The time wasted on dealing with issue on D, is time you can have 
spend in a different language actually writing code/testing. Its 
a barrier to the language its own success when its not as user 
friendly as the other languages.


If a person needs to do a action in Windows and it takes him 5 
mouse clicks. But hey, under Linux you can do it with one command 
line arg, ... the Linux approach sound more easy right? Until you 
add the time needed to learn the command and assuming there are 
no issues. What is more rewarding or punishing? There is a reason 
that Windows is still so popular. Windows does not get in the 
way. It just keep working. Can it be improved, yes! MS puts a 
massive amount of time and money in there testing. And it shows 
in there platform.


Its the same reason why Linux as a desktop OS will never work 
out. Too much puzzle pieces that do not fit, too much assumed 
that people need ( and have the time ) to learn the complicated 
way. A lack of inter-testing beyond just the basic compile tests 
( i mean really usage ).


Its easy to see the same attitude in D as a community project. 
There are GREAT pieces being written but everybody is working 
more as a solo developer, with no clear guideline. That is the 
big difference between a language like D and corporate backed 
languages.


I can easily think of a dozen extensions to D, that need to be 
part of the standard library or extended library of D, like 
DCompute, mir-algorithm, ...


Why? Because its again lose projects that you as a end consumer 
need to discover. Most of the time written and maintained by one 
person. Too much here is so single person focused, that its hard 
to see people continue the work if that person has no more time.


Too much here is single issue focused and it shows in the 
developers there background, what results in the testing of 
platforms, the interaction etc.


Maybe i explain this badly, but D seems has a lot of issues that 
people here are not aware off because they are already in the D 
mindset. And its those issues that show up the most, when one 
first tries this language.


Re: My first experience as a D Newbie

2017-10-16 Thread rikki cattermole via Digitalmars-d

On 16/10/2017 9:56 AM, Rion wrote:

On Sunday, 15 October 2017 at 20:27:35 UTC, Laeeth Isharc wrote:

D is much less gratifying than other languages for most people.
 Just like Windows was more gratifying than Linux for most people in 
2000.  And I suppose that's likely to change slowly, but continue to 
be the case for a while so long as people working on Windows don't 
notice when something isn't working and fix things at root cause.  
It's usually not that much more difficult to do so than work around 
it, and it usually pays off even considered selfishly.


I can appreciate your frustration, but considering how many years 
knowing a programming language can pay off for, a few hundred hours 
spent to learn something new isn't that much. That's like a couple of 
months full-time and if it works out the payback period should easily 
be a year.  Viewed rationally, that's a pretty good return on 
investment compared to most other opportunities available.


In a world where there are lots of smart people and knowledge is 
widely available, the barriers to opportunity (there must be barriers, 
otherwise the opportunity would be competed away) are often emotional 
ones.  So I like things where the difficulty is front-loaded, because 
they tend to be neglected by modern people who are used to quick 
gratification.  And whilst it surely can be frustrating, the situation 
is already better both on Windows and as regards documentation and 
tooling than it was in 2014.  It's not difficult to make little 
changes towards what one would like to see oneself.


When you invest this time into a language, you have expectations. A 
person expects for a language this old, that every puzzle fits together 
without issue.


Call me spoiled if you want but quick gratification it is not. The time 
wasted on dealing with issue on D, is time you can have spend in a 
different language actually writing code/testing. Its a barrier to the 
language its own success when its not as user friendly as the other 
languages.


If a person needs to do a action in Windows and it takes him 5 mouse 
clicks. But hey, under Linux you can do it with one command line arg, 
... the Linux approach sound more easy right? Until you add the time 
needed to learn the command and assuming there are no issues. What is 
more rewarding or punishing? There is a reason that Windows is still so 
popular. Windows does not get in the way. It just keep working. Can it 
be improved, yes! MS puts a massive amount of time and money in there 
testing. And it shows in there platform.


Its the same reason why Linux as a desktop OS will never work out. Too 
much puzzle pieces that do not fit, too much assumed that people need ( 
and have the time ) to learn the complicated way. A lack of 
inter-testing beyond just the basic compile tests ( i mean really usage ).


And yet my elderly-ish mother uses Linux Mint and she hates technology.
It isn't as clear cut as it may appear, these issues.



Re: Will D continu to live after walter death?

2017-10-16 Thread Rion via Digitalmars-d

On Thursday, 12 October 2017 at 15:04:57 UTC, moechofe wrote:

What is the wanted lifetime of the project?
Is D will manage to pass through time?
It is valuable to start a 40 years old project using D?


Its a serious topic but that gets way too much joking.

While D is part of the foundation, that is not the issue. It is 
leadership, focus, goals, long term vision ... There are not that 
many people that can take over that task successfullly.


I noticed its all a joke to people. Posted in a other topic about 
the fragmented nature of D and the high focus on solo developers. 
And the issue of what happens if a main developer of a extension 
has no more time or god forbids dies. That same applies to D as a 
language.


That D is in a Foundation means nothing. Apple without Jobs is 
still Apple but you can see the difference in there products 
after his dead.


Re: Why Physicists Still Use Fortran

2017-10-16 Thread qznc via Digitalmars-d

On Monday, 16 October 2017 at 00:26:20 UTC, H. S. Teoh wrote:
On Sun, Oct 15, 2017 at 03:09:21PM -0700, Walter Bright via 
Digitalmars-d wrote:

http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

Some good information there!


1-based array indexing...  I don't know, but I've become so 
accustomed to 0-based indexing that I doubt I'll ever be able 
to get used to a language with 1-based indexing.  Or whether D 
will ever be able to challenge Fortran in this respect. :P


Dijkstra made a good argument for zero-based:
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html




Re: Runtime.initialize nothrow?

2017-10-16 Thread Jacob Carlborg via Digitalmars-d

On 2017-10-15 16:19, Luís Marques wrote:
The initialize and terminate methods of core.runtime.Runtime aren't 
nothrow. Can initialize actually throw? If so, is it safe to catch the 
Throwable and use it, given that the RT isn't properly initialized? If 
it doesn't actually throw, shouldn't it be marked nothrow?


It can throw. If an exception is thrown during the initialization of the 
runtime it will be caught (this includes exceptions thrown in module 
constructors and similar). But when the runtime prints the caught 
exception it can throw again, because eventually it will call "toString" 
on the caught exception which can throw.


Adding an additional "catch" around the call to "toString" would solve that.

The rest of the functions that are called during the initialization of 
the runtime are just missing the "nothrow" annotation.


--
/Jacob Carlborg


Re: Will D continu to live after walter death?

2017-10-16 Thread Iain Buclaw via Digitalmars-d
On 12 October 2017 at 17:04, moechofe via Digitalmars-d
 wrote:
> What is the wanted lifetime of the project?
> Is D will manage to pass through time?
> It is valuable to start a 40 years old project using D?

I would be a lot more worried if something happened to me, if I were you.

Iain.


Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d
Btw, when I say you can actually develop complete web servers 
in Dart and Go just with the components provided in the 
standard libraries, I really mean it, even if I personally also


I programmed in Go.
I also was part of Dart team for about a year.
So yeah, I know what you mean.



Ok, then please can you explain why you say about web development 
libraries that "it’s not standard in Go and Dart", as you are 
probably the most informed person on that subject from the whole 
D community.


For instance, the web server behind my personal web site is 
EXCLUSIVELY based on Go's standard library, nothing else was 
used...


And moreover its code is incredibly concise and performant. Great 
job from Google engineering teams...




Re: D on quora ...

2017-10-16 Thread Jacob Carlborg via Digitalmars-d

On 2017-10-15 18:29, Ecstatic Coder wrote:

Can you just confirm that D's fibers use most of the available 
processors/cores by default ?


It depends entirely what you do with with the fibers. When it comes to 
vibe.d, it will only run on one core by default, last time I checked. 
Actually, I looked up the option for enabling multithreading for 
handling HTTP requests, it's now deprecated [1] and the recommendation 
is instead:


"If possible, instead of threads, the use of separate processes is more 
robust and often faster"


[1] http://vibed.org/api/vibe.http.server/HTTPServerOption.distribute

--
/Jacob Carlborg


Re: D on quora ...

2017-10-16 Thread Jacob Carlborg via Digitalmars-d

On 2017-10-16 07:20, Dmitry Olshansky wrote:

On Sunday, 15 October 2017 at 20:24:02 UTC, Adam Wilson wrote:

database access (MySQL, PostgreSQL, Aerospike) libraries are available,


That is important actually.



So important that it should be a Priority 0 Must Have.


Luckily it should also be quite strightforward to write them. At minimum 
there would be a C, Go, Java and Python “driver” to look at.


There are already drivers for MySQL (mysql-native) and PostgreSQL (ddb).

--
/Jacob Carlborg


Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d

On Monday, 16 October 2017 at 09:30:03 UTC, Jacob Carlborg wrote:

On 2017-10-15 18:29, Ecstatic Coder wrote:

Can you just confirm that D's fibers use most of the available 
processors/cores by default ?


It depends entirely what you do with with the fibers. When it 
comes to vibe.d, it will only run on one core by default, last 
time I checked. Actually, I looked up the option for enabling 
multithreading for handling HTTP requests, it's now deprecated 
[1] and the recommendation is instead:


"If possible, instead of threads, the use of separate processes 
is more robust and often faster"


[1] 
http://vibed.org/api/vibe.http.server/HTTPServerOption.distribute


Nowadays most web servers are multicore, so that's probably not 
very good to optimize their raw performance.


Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d

On Sunday, 15 October 2017 at 20:42:36 UTC, Laeeth Isharc wrote:
On Sunday, 15 October 2017 at 07:21:55 UTC, Ecstatic Coder 
wrote:
But as a C++ developer, I can tell you that : D's GC is what 
prevents me to use it for my current C++ programming tasks.


Because I can perfectly live with a GC that progressively 
collects bits of memory in a predefined amount of time, like 
in the Nim language, but not one that can pause my application 
for an unpredictable amount of time.


That's just my personal case and opinion, but I don't think 
I'm the only C++ programmer on the planet to dislike D's GC 
for typical C++ development cases, which are generally those 
where the lack of a GC is the reason that lead to the use of 
C++.


Out of curiosity, what is it that stops you keeping the heap 
small and allocating memory manually for the rest?


In D I've the added complexity in trying to use the game engine 
(cocos2dx, unreal, cryengine) C++ libraries from D.


So that's not worth the effort, if I can't use D's powerful 
standard library as usual.


I don't like the idea that any hidden object allocation or string 
concatenation can trigger a GC for an undefined amount of time.


In C++ you also have plenty of objects constructors/destructors 
called everywhere in your back, but none of them will ever 
trigger a GC...







Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d

On Monday, 16 October 2017 at 02:10:31 UTC, Jerry wrote:
On Sunday, 15 October 2017 at 16:29:22 UTC, Ecstatic Coder 
wrote:

If all that is already available, perfect :)

[snip]
And moreover I'd be delighted to start using D instead of Go 
for my next web server developments.


You can start now and get performance later? In fact you may 
supply important benchmarks from your day to day usage.


Ok. Still not convinced to use D instead of C++ for my 
personal use cases (games and other soft real-time apps), but 
I get the idea.


I switched my personal game to D from C++. Was easy, most of it 
was just copy paste. I was writing a math library to replace 
the one I was using to make it a bit more light way and to fit 
my needs a bit more. I didn't like how some thing were 
implemented in the library I was using. So I started with 
templates, I need multiple types and what not for the same 
purpose. At some point I have a function that needs to take 2 
different template types.
It starts to get so convoluted, order matters cause C++ still 
just uses copy-paste-includes and I don't think modules made it 
into C++17. I wrote the same library in half the code, in a way 
that's more readable and manageable. I didn't have to define 
things so that they would work, I could define them logically 
the way I'd expect them to be. Mixins also reduced code quite a 
bit, generating functions for different types and dimensions. 
Even though you have constexpr if statements now you still need 
to define all the function bodies even if they all can go in 
one function body now.


Thanks for sharing your experience !


Re: Will D continu to live after walter death?

2017-10-16 Thread Joakim via Digitalmars-d

On Monday, 16 October 2017 at 09:03:56 UTC, Rion wrote:

On Thursday, 12 October 2017 at 15:04:57 UTC, moechofe wrote:

What is the wanted lifetime of the project?
Is D will manage to pass through time?
It is valuable to start a 40 years old project using D?


Its a serious topic but that gets way too much joking.

While D is part of the foundation, that is not the issue. It is 
leadership, focus, goals, long term vision ... There are not 
that many people that can take over that task successfullly.


I noticed its all a joke to people. Posted in a other topic 
about the fragmented nature of D and the high focus on solo 
developers. And the issue of what happens if a main developer 
of a extension has no more time or god forbids dies. That same 
applies to D as a language.


That D is in a Foundation means nothing. Apple without Jobs is 
still Apple but you can see the difference in there products 
after his dead.


You're right that it's a valid question for the project, as the 
main D frontend is largely developed by Walter:


https://github.com/dlang/dmd/graphs/contributors

Kenji did a lot for 5 years, adding more lines of code than even 
Walter during that time, but appears to have bowed out since 
early last year.


Walter really should be mentoring dmd contributors, and actively 
looking for more. Druntime and phobos, on the other hand, seem to 
be developed by others, and don't depend as much on one person.


To answer the original question, it is almost impossible to plan 
for a 40 year-old project, given how fast tech changes.  You have 
to be prepared to maintain ancient toolchains yourself for such a 
long time horizon, like I imagine COBOL devs do today.


In that case, one of the main criteria should be that the entire 
toolchain is open-source and fairly understandable, because you 
will almost certainly have to maintain it yourself.  I don't 
think you can depend on even mainstream languages like C, C++, or 
Swift being around and having good support in 40 years.


Re: Will D continu to live after walter death?

2017-10-16 Thread Frank Fuente via Digitalmars-d

On Monday, 16 October 2017 at 09:09:03 UTC, Iain Buclaw wrote:
On 12 October 2017 at 17:04, moechofe via Digitalmars-d 
 wrote:

What is the wanted lifetime of the project?
Is D will manage to pass through time?
It is valuable to start a 40 years old project using D?


I would be a lot more worried if something happened to me, if I 
were you.


Iain.


A Bridge Too Far...

Field Marshal Model's aide: Field Marshal, thousands of 
paratroops have landed in this area, three kilometres from here.


Field Marshal Model: What? Why? There is nothing important 
here... me! I'm important! They must've landed here just to 
capture me.


[stands from his lunch and moves to the door]
Field Marshal Model: Get my car ready.

[makes to leave]
Field Marshal Model's aide: Yes, sir!

[about to leave himself]
Field Marshal Model: [pops back in and shouts] And don't forget 
my cigars!


Re: Will D continu to live after walter death?

2017-10-16 Thread codephantom via Digitalmars-d

On Monday, 16 October 2017 at 09:03:56 UTC, Rion wrote:

On Thursday, 12 October 2017 at 15:04:57 UTC, moechofe wrote:

What is the wanted lifetime of the project?
Is D will manage to pass through time?
It is valuable to start a 40 years old project using D?


Its a serious topic but that gets way too much joking.

While D is part of the foundation, that is not the issue. It is 
leadership, focus, goals, long term vision ... There are not 
that many people that can take over that task successfullly.


I noticed its all a joke to people. Posted in a other topic 
about the fragmented nature of D and the high focus on solo 
developers. And the issue of what happens if a main developer 
of a extension has no more time or god forbids dies. That same 
applies to D as a language.


That D is in a Foundation means nothing. Apple without Jobs is 
still Apple but you can see the difference in there products 
after his dead.


People can joke about an issue, and still take it as being 
serious.

Consider the poor comedians if that were not the case.

And btw. you can't compare Apple(s) with oranges ;-)

Also, what happens to all the Windows users, if Microsoft goes 
out of business?


There is no such thing as 'risk free' software development?

Being open-source, having a growing (volunteer) community, and 
encouraging that community to grow further, is the open-source 
way of managing those risks. And that is *exactly* what the 
'Foundation' is focused on.


It's all fairly new... be patient and give it time to grow.



Re: My first experience as a D Newbie

2017-10-16 Thread jmh530 via Digitalmars-d
On Monday, 16 October 2017 at 09:01:20 UTC, rikki cattermole 
wrote:


And yet my elderly-ish mother uses Linux Mint and she hates 
technology.

It isn't as clear cut as it may appear, these issues.


Linux mint is nice.


Re: What is the Philosophy of D?

2017-10-16 Thread Mark via Digitalmars-d

On Monday, 16 October 2017 at 00:25:32 UTC, codephantom wrote:
D's overview page says "It doesn't come with  an overriding 
philosophy."


Is philosophy not important?

I'd like to argue, that the problem of focusing on getting the 
job done quickly and reliably, does *not* leave behind 
maintainable, easy to understand code, but rather it leads to 
unintended outcomes ...


If the philosophy of C, is 'the programmer is in charge', what 
might the philosophy of D be?


e.g. Maximum precision in expression, perhaps?


It's not very catchy, but I would say "Genercity, productivity 
and performance all at once".


Re: D on quora ...

2017-10-16 Thread SrMordred via Digitalmars-d

From https://wiki.dlang.org/Vision/2017H2:

2. @nogc: Use of D without a garbage collector, most likely by 
using reference counting and related methods Unique/Weak 
references) for reclamation of resources. This task is made 
challenging by the safety requirement.


Eventually it will come (I hope) :)

I'm on the game programming in D train also.

And its a bless comparing to C++, but I have the same concerns 
about the impredictable GC pause time.





Re: What is the Philosophy of D?

2017-10-16 Thread qznc via Digitalmars-d

On Monday, 16 October 2017 at 00:25:32 UTC, codephantom wrote:
D's overview page says "It doesn't come with  an overriding 
philosophy."


Is philosophy not important?

I'd like to argue, that the problem of focusing on getting the 
job done quickly and reliably, does *not* leave behind 
maintainable, easy to understand code, but rather it leads to 
unintended outcomes ...


If the philosophy of C, is 'the programmer is in charge', what 
might the philosophy of D be?


e.g. Maximum precision in expression, perhaps?


The frontpage says "It combines efficiency, control and modeling 
power with safety and programmer productivity."


The three big words are: Convenience, Power, Efficiency.

What are the "philosophies" we are talking about? Probably the 
usual paradigms, like object-oriented, functional, etc. D 
supports them, but none of them is overriding or dominant. 
Maximum safety is another philosophy. D allows you to enhance 
safety (@safe) or diminish it (inline assembly).


Re: What is the Philosophy of D?

2017-10-16 Thread Ali via Digitalmars-d

On Monday, 16 October 2017 at 00:25:32 UTC, codephantom wrote:
D's overview page says "It doesn't come with  an overriding 
philosophy."




Then this is exactly, its philosophy

Some of the nicer comments I read about D, and one reason why it 
still stand a chance against other more hyped language such as 
Rust ...


is that D doesn't force any style of programming on you,

I understand that some people, like to keep an eye or have a 
view, of the strategic (long term) advantages of a language , and 
there is nothing really wrong with that


But, D ... isn't missing any long term vision, it has many, and 
its makers are lacking in the vision department... D just need 
developers to take advantages of it, on the short term ... to use 
it now


So if I may ... the current philosophy of D enthusiasts should be
"write code, not blogs"


Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d
On Monday, 16 October 2017 at 05:20:16 UTC, Dmitry Olshansky 
wrote:

On Sunday, 15 October 2017 at 20:24:02 UTC, Adam Wilson wrote:
database access (MySQL, PostgreSQL, Aerospike) libraries are 
available,


That is important actually.



So important that it should be a Priority 0 Must Have.


Luckily it should also be quite strightforward to write them. 
At minimum there would be a C, Go, Java and Python “driver” to 
look at.


Also surprisingly, D has superior driver for MySQL that talks 
native binary protocol while most other languages use the text 
mode.



preferably as a standard library (like in Dart and Go).


Can’t do that. And it’s not standard in Go and Dart but 
packages, dub

should work for that.



I've been thinking about this question a LOT, and I'm not 
convinced it's impossible to put the DB libs into the standard


Problem is - the development of std has glacial pace. Even if 
you put say Aerospike in std, I don’t think it’s in our best 
interest to have stagnated DB libs. DBs add features and ship 
new versions all the time.


What might work is JDBC style approach - having a common 
interface in std with implementations in 3rd party. SQL might 
work this way.


NoSQL though is highly irregular and benefits primarily from 
features unique to a particular vendor.


This is the best answer I've even been given on the main drawback 
of a standard library component.


Then I suggest that some script is used which "standardizes" the 
module component of a thirdparty library to make it belong to the 
"std" namespace, and put the result in the DMD/GDC/LDC 
installation packages.


Best of both worlds...


Re: D on quora ...

2017-10-16 Thread Atila Neves via Digitalmars-d

On Monday, 16 October 2017 at 09:58:46 UTC, Ecstatic Coder wrote:

On Sunday, 15 October 2017 at 20:42:36 UTC, Laeeth Isharc wrote:
On Sunday, 15 October 2017 at 07:21:55 UTC, Ecstatic Coder 
wrote:

[...]


Out of curiosity, what is it that stops you keeping the heap 
small and allocating memory manually for the rest?


In D I've the added complexity in trying to use the game engine 
(cocos2dx, unreal, cryengine) C++ libraries from D.


So that's not worth the effort, if I can't use D's powerful 
standard library as usual.


I don't like the idea that any hidden object allocation or 
string concatenation can trigger a GC for an undefined amount 
of time.


In C++ you also have plenty of objects constructors/destructors 
called everywhere in your back, but none of them will ever 
trigger a GC...


A std::shared_ptr going out of scope can pause the program for 
just as long as a GC mark-and-sweep.


Have you tried using a @nogc main loop in your programs/games? 
I'm curious to learn why that might not have worked for you.


Atila


Re: Will D continu to live after walter death?

2017-10-16 Thread Adam D. Ruppe via Digitalmars-d

On Monday, 16 October 2017 at 09:09:03 UTC, Iain Buclaw wrote:
I would be a lot more worried if something happened to me, if I 
were you.


No kidding.

The foundation is irrelevant... it is accumulated knowledge that 
we'd lose with someone going away. Walter has a lot of it... but 
so do a lot of other people. Many of us work on the frontend. 
Backend less so, but even there we'd be ok.


But Iain's knowledge and connections with gdc is stuff I have no 
clue about... and given that he does basically everything alone, 
I don't think anyone else does either.


Re: What is the Philosophy of D?

2017-10-16 Thread skymuse via Digitalmars-d

On Monday, 16 October 2017 at 00:25:32 UTC, codephantom wrote:
D's overview page says "It doesn't come with  an overriding 
philosophy."


Is philosophy not important?

I'd like to argue, that the problem of focusing on getting the 
job done quickly and reliably, does *not* leave behind 
maintainable, easy to understand code, but rather it leads to 
unintended outcomes ...


If the philosophy of C, is 'the programmer is in charge', what 
might the philosophy of D be?


e.g. Maximum precision in expression, perhaps?


I believe D not having a philosophy was very important when I 
ported all my projects from python to D. Let me explain.


I had a very important project that I've been using everyday for 
two-three years, written in python, and I grew tired of the 
negative effects of interpreted languages. I needed to take a 
risk and perform a complete rewrite to counter the issues. My new 
language needed to excel in the following categories for the 
rewrite to be successful:  performance, testing, and learning 
curve. The candidates were Rust, Go, Haskell, Swift, and of 
course D.


Rust had a difficult learning curve and it was not easy to port 
Python code to Rust, therefore that language was ignored. Haskell 
stuck to the philosophy of a purely functional language, which 
made the learning curve dramatic and I had to ignore this 
language. Swift seemed to be focus more on cocoa apps over 
command line apps, so I ignored this language as well. This left 
me with Go and D, both languages that solved my requirements. Let 
me tell you why I choose D.


D gave me the freedom to code the way I wanted to, Go forced me 
to think "simply". D gave me every feature possible to solve my 
problem, Go took them away. D allowed me to program in a style 
that matched the problem at hand, Go forced me to follow only one 
style. Are you seeing the pattern? When you religiously follow a 
philosophy, you're limited to only solving problems that play 
well with that philosophy.


Re: D on quora ...

2017-10-16 Thread Ola Fosheim Grøstad via Digitalmars-d

On Monday, 16 October 2017 at 13:49:50 UTC, Atila Neves wrote:
A std::shared_ptr going out of scope can pause the program for 
just as long as a GC mark-and-sweep.


I don't use shared_ptr much, but why would a single shared_ptr be 
that slow?




Re: D on quora ...

2017-10-16 Thread Paulo Pinto via Digitalmars-d
On Monday, 16 October 2017 at 14:14:50 UTC, Ola Fosheim Grøstad 
wrote:

On Monday, 16 October 2017 at 13:49:50 UTC, Atila Neves wrote:
A std::shared_ptr going out of scope can pause the program for 
just as long as a GC mark-and-sweep.


I don't use shared_ptr much, but why would a single shared_ptr 
be that slow?


Cascade deletion of nested data structures, with the possibility 
of causing stack overflow.


Nicely presented by Herb Sutter on his CppCon 2016 talk, 
"Leak-Freedom in C++... By Default.", which presented a GC like 
implementation for C++, using deferred pointer.


https://www.youtube.com/watch?v=JfmTagWcqoE


Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d

On Monday, 16 October 2017 at 13:49:50 UTC, Atila Neves wrote:
On Monday, 16 October 2017 at 09:58:46 UTC, Ecstatic Coder 
wrote:
On Sunday, 15 October 2017 at 20:42:36 UTC, Laeeth Isharc 
wrote:
On Sunday, 15 October 2017 at 07:21:55 UTC, Ecstatic Coder 
wrote:

[...]


Out of curiosity, what is it that stops you keeping the heap 
small and allocating memory manually for the rest?


In D I've the added complexity in trying to use the game 
engine (cocos2dx, unreal, cryengine) C++ libraries from D.


So that's not worth the effort, if I can't use D's powerful 
standard library as usual.


I don't like the idea that any hidden object allocation or 
string concatenation can trigger a GC for an undefined amount 
of time.


In C++ you also have plenty of objects 
constructors/destructors called everywhere in your back, but 
none of them will ever trigger a GC...


A std::shared_ptr going out of scope can pause the program for 
just as long as a GC mark-and-sweep.


Have you tried using a @nogc main loop in your programs/games? 
I'm curious to learn why that might not have worked for you.


Atila


Very honestly, shortly after your remark I've tried to use D in 
connection with cocos2d-x for a small mobile sports game, and 
after two days I've given up.


I've never managed to find an easy way to make D play well with 
cocos2d-x. Don't ask me about having it run on android.


But I'm not disgusted.

I still remain VERY interested in being able to developing all my 
desktop/mobile gaming developements in D.


It's just that it seems that I'm not smart enough to make this 
D/cocos2d-x/android magic happen by myself.


And as I said, I'd prefer to be able to regularly ask D to 
progressively collect its bits of memory in some limited and 
predefined amount of time (xxx ms) when and where I've decided 
to, in the Nim way.


For that also I'm clearly not smart enough to do the job by 
myself, and Dmitry has already explained me twice why he's 
against that...


So at the moment I'm just waiting that some D/GC/Android genius 
manages to make the impossible possible...




Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Manu via Digitalmars-d
On 15 Oct. 2017 11:50 pm, "Walter Bright via Digitalmars-d" <
digitalmars-d@puremagic.com> wrote:

On 10/15/2017 10:09 PM, Manu wrote:

> Haha, incidentally, I've just moved to LA, and I'm failing to convince
> myself I won't die if I try and drive here ;) .. I'm still chickening out.
>

LA? Cool!

(Don't watch "To Live and Die in LA")

Or just get a used "Yank Tank" and you'll be fine.


Hah. That would violate every principle I hold ;)
And besides, I'm pretty sure I'm only allowed to have an all-electric in
Southern California!


Re: My first experience as a D Newbie

2017-10-16 Thread Rion via Digitalmars-d
On Monday, 16 October 2017 at 09:01:20 UTC, rikki cattermole 
wrote:
And yet my elderly-ish mother uses Linux Mint and she hates 
technology.

It isn't as clear cut as it may appear, these issues.


Off-topic but the issue with Linux is not when you have it stable 
running ( assuming everything works perfectly out of the box ). 
Its when you update software. Nothing more fun as lockups when 
your kernel is updated but you need the update because it allows 
some other feature to work.


We are talking in the mindset of developers, not mothers who only 
use skype/browser/mail and do not care if the software is out of 
date. :)


Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Stefan Koch via Digitalmars-d

On Monday, 16 October 2017 at 15:22:30 UTC, Manu wrote:
On 15 Oct. 2017 11:50 pm, "Walter Bright via Digitalmars-d" < 
digitalmars-d@puremagic.com> wrote:


On 10/15/2017 10:09 PM, Manu wrote:

Haha, incidentally, I've just moved to LA, and I'm failing to 
convince myself I won't die if I try and drive here ;) .. I'm 
still chickening out.




LA? Cool!

(Don't watch "To Live and Die in LA")

Or just get a used "Yank Tank" and you'll be fine.


Hah. That would violate every principle I hold ;)
And besides, I'm pretty sure I'm only allowed to have an 
all-electric in

Southern California!


You hold principles ?


Re: D on quora ...

2017-10-16 Thread Ola Fosheim Grøstad via Digitalmars-d

On Monday, 16 October 2017 at 14:24:57 UTC, Paulo Pinto wrote:
On Monday, 16 October 2017 at 14:14:50 UTC, Ola Fosheim Grøstad 
wrote:

On Monday, 16 October 2017 at 13:49:50 UTC, Atila Neves wrote:
A std::shared_ptr going out of scope can pause the program 
for just as long as a GC mark-and-sweep.


I don't use shared_ptr much, but why would a single shared_ptr 
be that slow?


Cascade deletion of nested data structures, with the 
possibility of causing stack overflow.


Cascaded deletion? That's far more than a shared_ptr… Nobody does 
that in real code, unless they are prototyping.




Re: D on quora ...

2017-10-16 Thread Paulo Pinto via Digitalmars-d
On Monday, 16 October 2017 at 16:11:05 UTC, Ola Fosheim Grøstad 
wrote:

On Monday, 16 October 2017 at 14:24:57 UTC, Paulo Pinto wrote:
On Monday, 16 October 2017 at 14:14:50 UTC, Ola Fosheim 
Grøstad wrote:

On Monday, 16 October 2017 at 13:49:50 UTC, Atila Neves wrote:
A std::shared_ptr going out of scope can pause the program 
for just as long as a GC mark-and-sweep.


I don't use shared_ptr much, but why would a single 
shared_ptr be that slow?


Cascade deletion of nested data structures, with the 
possibility of causing stack overflow.


Cascaded deletion? That's far more than a shared_ptr… Nobody 
does that in real code, unless they are prototyping.


You would be amazed what real code on Fortune 500's looks like, 
specially if it comes from offshored projects.




Re: D on quora ...

2017-10-16 Thread Dmitry Olshansky via Digitalmars-d

On Monday, 16 October 2017 at 09:31:51 UTC, Ecstatic Coder wrote:
Btw, when I say you can actually develop complete web servers 
in Dart and Go just with the components provided in the 
standard libraries, I really mean it, even if I personally 
also


I programmed in Go.
I also was part of Dart team for about a year.
So yeah, I know what you mean.



Ok, then please can you explain why you say about web 
development libraries that "it’s not standard in Go and Dart",


Web development for me is usually a fair bit more then:
Register a bunch of handler functions that do Http Request -> 
Http Response

( Go std lib cira 2015)

There is templating, routing, some kind of ORM (sick) / ODM / 
DAO, access-control, authorization, marshaling, these things.


I recognize some of these have simple versions in Go’s std lib 
like templates and json serialization.


My point is not that http server is not bundled but rather that 
for me “whole http server” would imply some backend work i.e. DB 
drivers and other 3rd party stuff.


Go projects I worked on pulled in a great amount of these. Too 
much I’d say. There is a package for everything in Go or so it 
seems.


as you are probably the most informed person on that subject 
from the whole D community.


For instance, the web server behind my personal web site is 
EXCLUSIVELY based on Go's standard library, nothing else was 
used...


I just double checked and yes, you can’t do SQL without database 
“driver” package.


So I’m really curious how you get by without it... Files/REST API?



And moreover its code is incredibly concise and performant. 
Great job from Google engineering teams...


They have very nice runtime since around 1.6. Can’t agree on 
consie part, Go always looks verbose and repetative, a bit like 
Java 1.2. Dart also features quite capable JIT and runtime, in 
contrast to Go it’s quite concise but more high-level.






[OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread H. S. Teoh via Digitalmars-d
On Sun, Oct 15, 2017 at 10:09:04PM -0700, Manu via Digitalmars-d wrote:
>On 15 Oct. 2017 6:40 pm, "Walter Bright via Digitalmars-d"
><[1]digitalmars-d@puremagic.com> wrote:
[...]
>  I don't want to even try 1 based. All my learned behaviors with
>  arrays would just produce corrupt code.
> 
>  It's why I don't dare try driving in England.
> 
>Haha, incidentally, I've just moved to LA, and I'm failing to
>convince myself I won't die if I try and drive here ;) .. I'm still
>chickening out.
[...]

I've driven in LA before, even though I don't live there.  It's not half
as bad as people make it sound.  You just have to know the driving
culture of the place and act accordingly, that is, be assertive and
clear exactly what your intention is, and do not hesitate once you make
a decision.  Or, in more practical terms, know what you want, and *take*
it.  LA drivers know how to read the cues -- as long as you follow
through with what they think you will do.  It's when you waver and send
mixed signals that it gets dangerous.  They hate it when you look like
you're unsure, and it tends to make them angry and more aggressive.

Of course, this does not preclude safety considerations; in fact, it
means that you have to be absolutely sure what you want (and the safety
of what you want) before you even begin, lest you find yourself in a
dangerous situation with no safe way out.


T

-- 
What do you call optometrist jokes? Vitreous humor.


Re: D on quora ...

2017-10-16 Thread Jacob Carlborg via Digitalmars-d

On 2017-10-16 09:45, Adam Wilson wrote:

The most important SQL DB's all have high quality C libraries. Why not 
leverage those? 


If the drivers should be compatible with vibe.d the underlying C library 
needs to be compatible vibe.d's asynchronous event model. I don't know 
if they all (the C libraries) support asynchronous communication.


--
/Jacob Carlborg


Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Manu via Digitalmars-d
On 16 October 2017 at 10:56, H. S. Teoh via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On Sun, Oct 15, 2017 at 10:09:04PM -0700, Manu via Digitalmars-d wrote:
> >On 15 Oct. 2017 6:40 pm, "Walter Bright via Digitalmars-d"
> ><[1]digitalmars-d@puremagic.com> wrote:
> [...]
> >  I don't want to even try 1 based. All my learned behaviors with
> >  arrays would just produce corrupt code.
> >
> >  It's why I don't dare try driving in England.
> >
> >Haha, incidentally, I've just moved to LA, and I'm failing to
> >convince myself I won't die if I try and drive here ;) .. I'm still
> >chickening out.
> [...]
>
> I've driven in LA before, even though I don't live there.  It's not half
> as bad as people make it sound.  You just have to know the driving
> culture of the place and act accordingly, that is, be assertive and
> clear exactly what your intention is, and do not hesitate once you make
> a decision.  Or, in more practical terms, know what you want, and *take*
> it.  LA drivers know how to read the cues -- as long as you follow
> through with what they think you will do.  It's when you waver and send
> mixed signals that it gets dangerous.  They hate it when you look like
> you're unsure, and it tends to make them angry and more aggressive.
>
> Of course, this does not preclude safety considerations; in fact, it
> means that you have to be absolutely sure what you want (and the safety
> of what you want) before you even begin, lest you find yourself in a
> dangerous situation with no safe way out.
>

That... and they drive on the wrong side of the road! ;)


Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Jonathan M Davis via Digitalmars-d
On Monday, October 16, 2017 11:42:56 Manu via Digitalmars-d wrote:
> That... and they drive on the wrong side of the road! ;)

http://jokes.cc.com/funny-lookin--good/yn3vw9/the-wrong-way

- Jonathan M Davis



Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread H. S. Teoh via Digitalmars-d
On Mon, Oct 16, 2017 at 11:42:56AM -0700, Manu wrote:
[...]
>That... and they drive on the wrong side of the road! ;)
[...]

Ah!  Well, that is a different story, then. :D  My hometown also drives
on the wrong side of the road (I learnt driving after I left), and I'm
also still chickening out, in spite of having driven in LA.  :P  Well,
that, and over there there are no driving laws -- the so-called "laws"
are in practice only rarely-heeded recommendations.  You find 3 lanes of
moving cars on a 2-lane road, and people parallel-park leaving only 2
inches between cars.  Nope, not for me. :D

I suppose this is like Walter not daring to write code with 1-based
arrays. :D  On that note, though, in D I only rarely actually need to
specify explicit indices.  Foreach and generic code alleviates most
cases of explicit indexing I'd normally write in C/C++ code, and I
wouldn't be surprised if much of my code could actually be ported to
1-based indexing with only minor changes.

But I suppose if you're doing matrix/tensor math, you can't really avoid
this.


T

-- 
Democracy: The triumph of popularity over principle. -- C.Bond


Re: My first experience as a D Newbie

2017-10-16 Thread Random D user via Digitalmars-d
On Friday, 13 October 2017 at 13:14:39 UTC, Steven Schveighoffer 
wrote:

I don't know what the expectations of a Windows user are.


In my exprience 80% of mainly Windows devs (in professional 
environment) use Visual Studio + plugins (e.g. Visual 
Assist/Dpack etc.). Most of the remaining 20% use Visual Studio 
with vim keybindings/emulation or they code with vim/emacs, but 
use Visual Studio for debugging. And the last 2% use something 
completely different.


I think Visual Studio is the professional standard for C/C++/C# 
on Windows (as in Windows is the main platform and not some bad 
port hacked on top of cygwin). Basically what Xcode is for Mac.




Re: D on quora ...

2017-10-16 Thread Ecstatic Coder via Digitalmars-d
On Monday, 16 October 2017 at 17:17:29 UTC, Dmitry Olshansky 
wrote:
On Monday, 16 October 2017 at 09:31:51 UTC, Ecstatic Coder 
wrote:
Btw, when I say you can actually develop complete web 
servers in Dart and Go just with the components provided in 
the standard libraries, I really mean it, even if I 
personally also


I programmed in Go.
I also was part of Dart team for about a year.
So yeah, I know what you mean.



Ok, then please can you explain why you say about web 
development libraries that "it’s not standard in Go and Dart",


Web development for me is usually a fair bit more then:
Register a bunch of handler functions that do Http Request -> 
Http Response

( Go std lib cira 2015)

There is templating, routing, some kind of ORM (sick) / ODM / 
DAO, access-control, authorization, marshaling, these things.


I recognize some of these have simple versions in Go’s std lib 
like templates and json serialization.


My point is not that http server is not bundled but rather that 
for me “whole http server” would imply some backend work i.e. 
DB drivers and other 3rd party stuff.


Go projects I worked on pulled in a great amount of these. Too 
much I’d say. There is a package for everything in Go or so it 
seems.


as you are probably the most informed person on that subject 
from the whole D community.


For instance, the web server behind my personal web site is 
EXCLUSIVELY based on Go's standard library, nothing else was 
used...


I just double checked and yes, you can’t do SQL without 
database “driver” package.


So I’m really curious how you get by without it... Files/REST 
API?




And moreover its code is incredibly concise and performant. 
Great job from Google engineering teams...


They have very nice runtime since around 1.6. Can’t agree on 
consie part, Go always looks verbose and repetative, a bit like 
Java 1.2. Dart also features quite capable JIT and runtime, in 
contrast to Go it’s quite concise but more high-level.


If you had tried my website you would have noticed that it's a 
static web site, so no SQL was harmed during its production ;)


And to be 100% honest with you, indeed I actually don't program 
in Go but in my own proprietary language which emits Go code from 
a syntax similar to my Phoenix language, hence the "concise" 
adjective.


(it's here if you are curious about it : 
https://github.com/senselogic/PHOENIX)


Additionally to the Phoenix-like syntax, Helix allows me to use 
Allman style, macro-based genericity (through multi-token 
substitution), which is nice, even if several Go fanatics have 
explained me in a not so kind manner how and why it would silly 
and useless to do that, as Go is already perfect.


(I had the same remarks from PHP coders for Phoenix btw).

But I don't care, it's my own personal language, and since one of 
Go's designed has decided to piss over me twice (guess who), I've 
decided to keep it for me and let the Go community program the 
way they want, i.e. by using slow-as-hell interfaces for 
everything or repeatedly copy-paste-modify the same lines of 
code...


And YES, despite their flaws, I still think that Dart and Go are 
by far the best web development languages we have right now, 
especially compared to PHP and JavaScript/Node.js.




Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Steven Schveighoffer via Digitalmars-d

On 10/16/17 2:42 PM, Manu wrote:


That... and they drive on the wrong side of the road! ;)


We drive on the right side. Both literally and philosophically :)

Seriously though, driving in LA is nothing compared to an eastern city 
where everything was determined by horse-cart paths.


I drove a car in England once. The most difficult thing to do was coming 
back home. There, I was acutely aware of the awkwardness, given that the 
shifter was on my left and not the right. When I came back, going to 
make turns, I was second guessing everything!


-Steve


Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread jmh530 via Digitalmars-d

On Monday, 16 October 2017 at 18:56:03 UTC, H. S. Teoh wrote:


I suppose this is like Walter not daring to write code with 
1-based arrays. :D  On that note, though, in D I only rarely 
actually need to specify explicit indices.  Foreach and generic 
code alleviates most cases of explicit indexing I'd normally 
write in C/C++ code, and I wouldn't be surprised if much of my 
code could actually be ported to 1-based indexing with only 
minor changes.


But I suppose if you're doing matrix/tensor math, you can't 
really avoid this.





I always thought slicing was a more important difference for 0 or 
1-based indexing, rather than loops.


Consider D's A[m..n] vs. Matlab's A[m:n]. Matlab's is easier to 
explain to someone with a math background because you get A[m] 
through A[n, instead of A[m] through A[n-1] in Ds. However, D's 
A[m..n].length = n - m, whereas Matlab's length(A[m:n])= n - m + 
1. Thus, you often find yourself adjusting formulae all over the 
place to account for the extra "+1". Nevertheless, if you have 
more of a mathematics background, you always need to remember 
that if you wanted A[m:n] in Matlab, you need A[(m - 1)..n] to 
get the equivalent in D.




Re: What is the Philosophy of D?

2017-10-16 Thread Moritz Maxeiner via Digitalmars-d

On Monday, 16 October 2017 at 00:25:32 UTC, codephantom wrote:
D's overview page says "It doesn't come with  an overriding 
philosophy."


Is philosophy not important?

I'd like to argue, that the problem of focusing on getting the 
job done quickly and reliably, does *not* leave behind 
maintainable, easy to understand code, but rather it leads to 
unintended outcomes ...


If the philosophy of C, is 'the programmer is in charge', what 
might the philosophy of D be?


e.g. Maximum precision in expression, perhaps?


"Get it done, but also right"


Re: Proposal: Object/?? Destruction

2017-10-16 Thread sarn via Digitalmars-d

On Sunday, 15 October 2017 at 15:19:21 UTC, Q. Schroll wrote:

On Saturday, 14 October 2017 at 23:20:26 UTC, sarn wrote:

On Saturday, 14 October 2017 at 22:20:46 UTC, Q. Schroll wrote:
Therefore, and because of brackets, you can distinguish f(1, 
2) from f([1, 2]).


But in f([1, 2]), it's ambiguous (just by parsing) whether [1, 
2] is a tuple literal or a dynamic array literal.


It would be a tuple if that's the best match, otherwise 
conversion to int[] is tried.

...

You'd need to use a prefix or something to the bracket syntax.
[snip]


I just argued, you don't!


But have you thought through all the implications?

Take this code:

void main(string[] args)
{
import std.stdio : writeln;
writeln([1, 3.14]);
}

As you're probably 100% aware, this is totally valid D code 
today.  [1, 3.14] becomes a double[] because 1 gets converted to 
a double.  If this kind of behaviour changes, code will break, so 
you'll need a bunch of exceptions to the "it would be a tuple if 
that's the best match" rule.  Also, for the same backwards 
compatibility reasons, it would be impractical in most cases to 
add any tuple overloads to most existing standard library 
functions that currently accept slices or arrays, but presumably 
new functions would be meant to take advantage of the new syntax 
(else there wouldn't be much point creating a new syntax).


So, a literal like [1, 3.14] would basically be a tuple, but 
would be converted to double[] in a bunch of special cases for 
historical reasons.


If you're not sure if this is really a problem, take a look at 
the confusion caused by the magic in {} syntax:


https://forum.dlang.org/thread/ecwfiderxbfqzjcyy...@forum.dlang.org
https://forum.dlang.org/thread/ihsmxiplprxwlqkgw...@forum.dlang.org
https://forum.dlang.org/thread/qsayoktyffczskrnm...@forum.dlang.org

To be totally honest, I still don't see what's wrong with just 
creating a new bracket syntax, instead of adding more magic to [] 
(or () for that matter).


Re: What is the Philosophy of D?

2017-10-16 Thread codephantom via Digitalmars-d

On Monday, 16 October 2017 at 13:56:34 UTC, skymuse wrote:

...Let me tell you why I choose D.

D gave me the freedom to code the way I wanted to, Go forced me 
to think "simply". D gave me every feature possible to solve my 
problem, Go took them away. D allowed me to program in a style 
that matched the problem at hand, Go forced me to follow only 
one style. Are you seeing the pattern? When you religiously 
follow a philosophy, you're limited to only solving problems 
that play well with that philosophy.


Don't confuse religion and philosophy. One is a dynamic const, 
the other is purely dynamic ;-)


I take it from your story, that one could say the philosophy of 
D, is:


'Do it your way'.

That sounds like a great philosophy! And it certainly fits with 
my understanding of the capabilities of D, and perhaps is 
indicative of the spirit in which D came about ;-)


Re: What is the Philosophy of D?

2017-10-16 Thread ketmar via Digitalmars-d

codephantom wrote:


I take it from your story, that one could say the philosophy of D, is:

'Do it your way'.


and "have fun" too. this is important.


Re: D on quora ...

2017-10-16 Thread Dmitry Olshansky via Digitalmars-d

On Monday, 16 October 2017 at 20:02:16 UTC, Ecstatic Coder wrote:
On Monday, 16 October 2017 at 17:17:29 UTC, Dmitry Olshansky 
wrote:

On Monday, 16 October 2017 at 09:31:51 UTC, Ecstatic Coder


If you had tried my website you would have noticed that it's a 
static web site, so no SQL was harmed during its production ;)


And to be 100% honest with you, indeed I actually don't program 
in Go but in my own proprietary language which emits Go code 
from a syntax similar to my Phoenix language, hence the 
"concise" adjective.


I actually think that Go is quite an attractive _runtime_ to 
target. Sooner or later somebody should notice that too.




(it's here if you are curious about it : 
https://github.com/senselogic/PHOENIX)


Additionally to the Phoenix-like syntax, Helix allows me to use 
Allman style, macro-based genericity (through multi-token 
substitution), which is nice, even if several Go fanatics have 
explained me in a not so kind manner how and why it would silly 
and useless to do that, as Go is already perfect.


Yeah, the biggest disservice to Go community is a decent amount 
of blind fanatics.




(I had the same remarks from PHP coders for Phoenix btw).

But I don't care, it's my own personal language, and since one 
of Go's designed has decided to piss over me twice (guess who), 
I've decided to keep it for me and let the Go community program 
the way they want, i.e. by using slow-as-hell interfaces for 
everything or repeatedly copy-paste-modify the same lines of 
code...


Yeah, seen a lot of these. And then, of course, crude in-house 
codegen tools :)




And YES, despite their flaws, I still think that Dart and Go 
are by far the best web development languages we have right 
now, especially compared to PHP and JavaScript/Node.js.