Re: Understanding the Use of Nested Import and Selective Import in D

2024-01-17 Thread Orfeo via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 19:05:43 UTC, Jonathan M Davis 
wrote:


When local imports were introduced, they were pushed as best 
practice (in part, because Andrei is a big fan of them), and I 
think that for the most part, they still are, but there's 
definitely going to be some disagreement on it.


[...]


thanks a bunch for your in-depth analysis.
Your insights have been  helpful in clarifying my understanding 
of how to approach `import` in my code.


Re: Understanding the Use of Nested Import and Selective Import in D

2024-01-16 Thread Orfeo via Digitalmars-d-learn

On Tuesday, 16 January 2024 at 13:19:59 UTC, Orfeo wrote:
I found myself a bit perplexed when it comes to the usage of 
"nested imports" and selective imports. It seems that prominent 
D programmers have varied opinions on the matter. I would love 
to hear your insights and experiences on this topic.


[...]



see also [Workaround for DIP 
1005](http://forum.dlang.org/post/tzqzmqhankrkbrfsr...@forum.dlang.org)


Understanding the Use of Nested Import and Selective Import in D

2024-01-16 Thread Orfeo via Digitalmars-d-learn
I found myself a bit perplexed when it comes to the usage of 
"nested imports" and selective imports. It seems that prominent D 
programmers have varied opinions on the matter. I would love to 
hear your insights and experiences on this topic.


Here's a quick summary of what I've come across from three 
influential D programmers:


- Adam Ruppe: In his blog post titled [D's selective imports have 
effects you may not 
want](http://dpldocs.info/this-week-in-arsd/Blog.Posted_2023_11_06.html) have effects you may not want, Adam advises against the use of selective imports. He highlights potential unwanted side effects and suggests caution when employing them.


- Atila Neves: At DConf 2023, Atila Neves recommended the use of 
nested imports. He argues that nested imports can make 
refactoring easier and help in assessing the dependencies a 
function has.


- Rober Schadek: Also at DConf 2023, Rober Schadek discouraged 
the use of nested imports, taking a stance different from Atila 
Neves.


Now, the big question is: What's your preferred approach?


vibe.d community/forum/whatever ?

2022-06-30 Thread Orfeo via Digitalmars-d-learn

https://forum.dlang.org/post/gbpasireizpjfifmq...@forum.dlang.org

On Monday, 30 August 2021 at 12:51:38 UTC, someone wrote:
On Monday, 30 August 2021 at 10:37:38 UTC, Steven Schveighoffer 
wrote:


It used to be moderated somewhat, but I think they gave up 
(99% of the messages were porn or spam).


Why don't they shut down the forum instead ?

It makes a terrible impression for newcomers -something akin 
to: naaah, this can't be a serious project.


Agreed


Re: Release: serverino - please destroy it.

2022-05-11 Thread Orfeo via Digitalmars-d-announce

well done Andrea!

(forum begins to be too crowded with Italians :) )


---
Orfeo




Re: Strange function

2019-11-12 Thread Orfeo via Digitalmars-d-learn

On Tuesday, 12 November 2019 at 21:05:35 UTC, Adam D. Ruppe wrote:

On Tuesday, 12 November 2019 at 20:45:11 UTC, Orfeo wrote:

In druntime (core/bitop.d line 302) I found this function


it is a magic function that the compiler recognizes and outputs 
a cpu instruction instead of a regular call.


core.bitop has a few of those.


Wow! Thank you very much


Re: Which is the active fork in DFL gui library ?

2019-11-12 Thread Orfeo via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:01:27 UTC, Vinod K Chandran 
wrote:

Hi all,
I just found that DFL gui library very interesting. But after 
some searching, i can see that DFL is inactive and there is few 
other forks for it. So this is my question - Which fork is good 
for a gui development in windows platform.
BTW, i just tested the gtkD and successfully compiled a hello 
app. How do i avoid the console window when compiling gtkD app ?

Thanks in advance.


Another similar work is [DGui](https://github.com/o3o/dguihub)


Strange function

2019-11-12 Thread Orfeo via Digitalmars-d-learn

In druntime (core/bitop.d line 302) I found this function

```
/**
 * Tests and resets (sets to 0) the bit.
 */
int btr(size_t* p, size_t bitnum) pure @system;

```



Honestly don't understand: where is the body of the function?

I thought I could find something like that:

```
int btr(size_t* p, size_t bitnum) pure @system {
  // body
}


Thank you







Re: strangely silent compiler

2019-08-21 Thread Orfeo via Digitalmars-d-learn
On Wednesday, 21 August 2019 at 13:56:51 UTC, Eugene Wissner 
wrote:

On Wednesday, 21 August 2019 at 13:41:20 UTC, Orfeo wrote:

I've:
```
module anomalo.util;

// Foo doesn't exist  anywhere!

Foo toJsJson(string type, Args...)(string id, Args args) {
   static if (type == "int" || type == "outcome") {
  return Json(["id" : Json(id), "type" : Json(type), 
"value" : Json(0),]);

   } else {
  static assert(0, "invalid type");
   }
}

```

So:
```
$ dub build
```
No error!

```
$ /usr/bin/dmd -lib -ofliba.a -debug -g -w -I. 
src/anomalo/util.d -vcolumns

```

No error!

Here [github](https://github.com/o3o/anomalo) my project.

Thank you


toJsJson is a template. Templates are evaluated first when they 
are instantiated. Compiler doesn't give an error because it 
doesn't compile toJsJson, because you don't instantiate it 
anywhere.


You're right: if I add (into util.d)

```
unittest {
   import std.stdio;
   writeln(toJsJson!"int"("a"));
}
```


voila' :
```
$ dub test

src/anomalo/util.d(3,5): Error: undefined identifier Foo
src/anomalo/util.d(13,26): Error: template instance 
`anomalo.util.toJsJson!"int"` error instantiating

/usr/bin/dmd failed with exit code 1.
```

Thank you


strangely silent compiler

2019-08-21 Thread Orfeo via Digitalmars-d-learn

I've:
```
module anomalo.util;

// Foo doesn't exist  anywhere!

Foo toJsJson(string type, Args...)(string id, Args args) {
   static if (type == "int" || type == "outcome") {
  return Json(["id" : Json(id), "type" : Json(type), "value" 
: Json(0),]);

   } else {
  static assert(0, "invalid type");
   }
}

```

So:
```
$ dub build
```
No error!

```
$ /usr/bin/dmd -lib -ofliba.a -debug -g -w -I. src/anomalo/util.d 
-vcolumns

```

No error!

Here [github](https://github.com/o3o/anomalo) my project.

Thank you




Re: dip1000 issue

2018-09-07 Thread Orfeo via Digitalmars-d-learn
On Friday, 7 September 2018 at 14:36:18 UTC, rikki cattermole 
wrote:

On 08/09/2018 2:29 AM, Orfeo wrote:
==> And why (maybe a silly question) `-dip1000` breaksĀ  my 
project so badly without warning..


DIP 1000 is an experimental addition to D, that is yet to be 
complete.
It is a compiler switch for a reason, it isn't ready for usage, 
only some experimentation.


Thank you very much...
I agree with you, but if someone adds `dip1000` in a library and 
I link it,  my project inherits this setting.

What do you think? is it correct? Some suggestions to avoid it?


Re: dip1000 issue

2018-09-07 Thread Orfeo via Digitalmars-d-learn

Sorry, I pressed send too quickly
On Friday, 7 September 2018 at 14:04:47 UTC, Orfeo wrote:

I've a project that link FuzzyCopy [1], that was compiled 
without problems.

So I add FuzzyCopy library [1], I update dmd, then:


==> I've a project that was compiled without problems.
So I add FuzzyCopy library [1], I update dmd, then:


And why (maybe a silly question) `-dip1000`dip1000  my project 
so badly without warning..


==> And why (maybe a silly question) `-dip1000` breaks  my 
project so badly without warning..




dip1000 issue

2018-09-07 Thread Orfeo via Digitalmars-d-learn

I wanted to highlight a problem that drove me crazy.

I've a project that link FuzzyCopy [1], that was compiled without 
problems.

So I add FuzzyCopy library [1], I update dmd, then:

```
$ dmd --version
DMD64 D Compiler v2.082.0
Copyright (C) 1999-2018 by The D Language Foundation, All Rights 
Reserved written by Walter Bright


$ dub build --verbose

/usr/bin/dmd -dip1000 -dip25 -c 
-of.dub/build/application-debug-linux.posix-x86_64-dmd_2082-C9F52D2A0CA0970ECB75169BD9B6C34D/jan.o -debug -g -w -version=VibeDefaultMain -version=VibeUseOpenSSL11 . -vcolumns
FAIL 
.dub/build/application-debug-linux.posix-x86_64-dmd_2082-C9F52D2A0CA0970ECB75169BD9B6C34D/ jan executable


/usr/bin/dmd failed with exit code -11.
```

after losing a lot of time, I realized that the problem was 
`-dip1000`: in FuzzyCopy dub is written:

```json
"dflags": ["-dip1000", "-dip25"],
```
If I remove it all works like a charm.

So, is it  correct that my project inherits settings of another 
library?
And why (maybe a silly question) `-dip1000`dip1000  my project so 
badly without warning..


Thank you


- [1] https://github.com/burner/FuzzyCopy
- [2] https://github.com/burner/FuzzyCopy/blob/master/dub.json



Re: Strange behavior using array of structures

2018-04-04 Thread Orfeo via Digitalmars-d-learn

On Wednesday, 4 April 2018 at 10:09:41 UTC, sarn wrote:

On Wednesday, 4 April 2018 at 10:00:18 UTC, Orfeo wrote:

  foreach (l; log) {
 l.run;
  }


Try making this "foreach (ref l; log) {".

Structs are value types in D, so by default they're copied when 
you assign them to another variable (in this case l).  That 
means run() is modifying a copy that gets thrown away each 
time.  "ref l" makes l into a reference to the original struct 
instance.


Great!! thank you very much


Strange behavior using array of structures

2018-04-04 Thread Orfeo via Digitalmars-d-learn

Hi all,
I have:

```
import std.stdio;

void main() {
   Logger[] log;
   Logger l0 = Logger(0,1);
   Logger l1 = Logger(100,1);
   Logger l2 = Logger(200,1);
   log ~= l0;
   log ~= l1;

   foreach (i; 0 .. 3) {
  writeln("it:", i);
  foreach (l; log) {
 l.run;
  }
   }
}

struct Logger {
   int initial;
   int increment;
   void run() {
  initial += increment;
  writeln("\t", initial);
   }
}
```
Output:
```
it:0
1
101
it:1
1
101
it:2
1
101
```
If I use:
```
void main() {
   Logger[] log;
   Logger l0 = Logger(0,1);
   Logger l1 = Logger(100,1);
   Logger l2 = Logger(200,1);
   log ~= l0;
   log ~= l1;
   foreach (i; 0 .. 3) {
  writeln("it:", i);
  l0.run();
  l1.run();
   }
}
```
output (correct) is:
```
it:0
1
101
it:1
2
102
it:2
3
103
```
can someone help me to understand? Thanks!




Re: Must I compile on the target architecture?

2015-12-26 Thread Orfeo via Digitalmars-d-learn

On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:

Hi, just a quick question:

If I write a program in D and I use Windows for development but 
want it to run on Linux, do I have to copy the source code to 
the target Linux machine and compile it there, to make an 
executable for that machine? What is the standard process for 
cross platform compilation?


See also [Should I compile D program on Linux for 
windows?](http://stackoverflow.com/questions/13501595/should-i-compile-d-program-on-linux-for-windows/13502264#13502264)


Re: Voting for std.experimental.testing

2015-10-08 Thread Orfeo via Digitalmars-d
On Thursday, 8 October 2015 at 08:21:58 UTC, Robert burner 
Schadek wrote:
Please respond to this post with a comment starting with a 
single "Yes"/"No" and optional explanation after that. Criteria 
you are expected to evaluate as part of "Yes":


Yes


Re: Setting um makefile for dmd

2015-06-30 Thread Orfeo via Digitalmars-d-learn

something like that can help?
```
run: all
   $(OUT)

```


Re: Looking for MQTT client library

2015-05-07 Thread Orfeo via Digitalmars-d-learn

On Thursday, 23 April 2015 at 14:40:01 UTC, Frank Pagliughi wrote:
I got the OK to submit the D library to Eclipse Paho. So, 
hopefully within the next few weeks there will be a Paho 
incubator project for the D language client.

Hi Frank,
any news about your MQTT client project?

Thank you


Re: Filling out the wiki - D as a second language

2015-04-16 Thread Orfeo via Digitalmars-d

On Tuesday, 31 March 2015 at 22:25:29 UTC, rumbu wrote:
I started some C# to D stuff here: 
https://github.com/rumbu13/sharp/blob/master/cstod.md


Unfortunately, I cannot edit directly on wiki.dlang.org since 
my account is not confirmed (confirmation e-mail is not sent 
despite several attempts).


Thank you for your great contribution, I started porting from 
github to wiki here 
http://wiki.dlang.org/Programming_in_D_for_CSharp_Programmers


Re: OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format

2015-03-20 Thread Orfeo via Digitalmars-d-learn

You can refer to
http://forum.dlang.org/post/jhbgaacoguxaubxgp...@forum.dlang.org

Do you use dub?
I resolved my problems (on Win) abandoning dub
and using makefile.


On Friday, 20 March 2015 at 17:35:19 UTC, Koi wrote:

Hello,

after some coding i needed to update some external libraries 
like

DerelictSDL2. As we all know, one update isn't enough, so i
updated my whole d-environment at the end of the day (current 
dmd

version, VisualD).

After getting rid of some linking errors (symbols undefined) i
have only one error left:
Optlink:
Error 45: Too Much DEBUG Data for Old CodeView format

i googled, but really can't figure out what this error is about.




Re: Looking for MQTT client library

2015-03-12 Thread Orfeo via Digitalmars-d-learn
My preferred option is b. that is convert your MQTT broker to 
MQTT client.


I'm not a MQTT expert, so, in your opinion what parts of your 
code should I change?

(i.e. message module should be the same, peraphs module stream...)

Thanks for your support

(and also for your unit-threaded project!)


On Thursday, 12 March 2015 at 15:03:13 UTC, Atila Neves wrote:
Those are basically your options. You could wrap Mosquitto (a C 
implementation), but I'd just use the existing MQTT broker 
code. Then again, I would say that. :)


Atila


Re: Endovena: a dependency injection framework.

2014-10-22 Thread Orfeo via Digitalmars-d-announce

-8-

Container gets confusing with std.container.

-8-

I agree with you, but 'Container' is widely used in DI context, 
for example:


* SimpleInjector (C#) uses Container
* LightInjector uses ServiceContainer
* Autofac uses ContainerBuilder
* LightCore  uses ContainerBuilder
* Hiro uses MicroContainer
* LinFu uses ServiceContainer
* HaveBox uses Container
* Spring (Java) uses Container
* Hypodermic (C++) ContainerBuilder
* Poodins (D) uses Container


Furthermore std.container doesn't have a class named Container, 
so it's
difficult to confuse class endovena.Container with module 
sdt.container...anyway, I'll think about it.


Thank you very much for your feedback


Endovena: a dependency injection framework.

2014-10-17 Thread Orfeo via Digitalmars-d-announce

Hi all,

I'd like to announce the initial version of endovena, a 
dependency injection

framework.

It's based on dejector, a great work by Jakub Stasiak, with some 
new features borrowed from dryioc (C# IoC)


I would be glad to see any feedback,
Thank you.

* [endovena] https://github.com/o3o/endovena Boost License 1.0
* [dejector](https://github.com/jstasiak/dejector)
* [dryioc](https://bitbucket.org/dadhi/dryioc)


[OT]I throw in the towel

2014-06-25 Thread Orfeo via Digitalmars-d-learn
I wanted to create a simple application to display and edit data 
from  postgresql database using GtkD and ddb 
(https://github.com/pszturmaj/ddb)


The application should run on WinXp or Win7. After a week of work 
I throw in the towel ...


1. The first problem
$ dub build
Unexpected Termination OPTLINK at t = EIP 0040F5Ba
After many attempts to find a solution 
(http://forum.dlang.org/thread/gskuwiynupngpungy...@forum.dlang.org)


$ dub build --rdmd

After writing a bit of code another problem:

$ dub build --rdmd
  Error 45: Too Much Data for Old DEBUG CodeView format

$ dub --build=release --rdmd
C:\Documents and Settings\dao\Application 
Data\dub\packages\gtk-d-2.3.3\src\gtk\Builder.d(489): Error: ICE: 
cannot append 'char' to 'string'


(see https://github.com/gtkd-developers/GtkD/issues/91 and 
https://issues.dlang.org/show_bug.cgi?id=12243)


I love D but, with tail between legs, I come back to csharp...

(BTW on Linux it's works well)


Re: Unexpected OPTLINK Termination while building ddb and gtkd

2014-06-24 Thread Orfeo via Digitalmars-d-learn

If I compile with rdmd
```
$ dub build --rdmd
```
it works


Unexpected OPTLINK Termination while building ddb and gtkd

2014-06-23 Thread Orfeo via Digitalmars-d-learn

My dub.json :
```
{
   name: ddb_test,
   description: A minimal D application.,
   dependencies: {
   gtk-d:gtkd: =2.3.3,
   ddb: =0.2.1
}
}

```

My source (source/app.d):
```
import ddb.postgres;
import gtk.Window;

int main(string[] argv) {
return 0;
}
```

On linux works, on WinXp and Win7 64bit I get following:

```
$ dub build --force
Building ddb 0.2.1 configuration library, build type debug.
Running dmd...
Building gtk-d:gtkd 2.3.3 configuration library, build type
debug.
Running dmd...
Building ddb_test ~master configuration application, build type
debug.
Compiling using dmd...
Linking...
```
I get a message:
   Unexpected OPTLINK Termination a t EIP=0040F5Ba



If I comment just a row on app.d:
```
import ddb.postgres;
// import gtk.Window;  = 

int main(string[] argv) {
return 0;
}
```
it works!

Thank you


Re: DUB linking problem on WinXp

2014-06-20 Thread Orfeo via Digitalmars-d-learn

Well, after many attempts, I have found what is causing the
problem.

My dub.json :
```
{
   name: ddb_test,
   description: A minimal D application.,
   dependencies: {
   gtk-d:gtkd: =2.3.3,
   ddb: =0.2.1
}
}

```

My source (source/app.d):
```
import ddb.postgres;
import gtk.Window;

int main(string[] argv) {
return 0;
}
```

On linux works, on WinXp and Win7 64bit I get following:

```
$ dub build --force
Building ddb 0.2.1 configuration library, build type debug.
Running dmd...
Building gtk-d:gtkd 2.3.3 configuration library, build type
debug.
Running dmd...
Building ddb_test ~master configuration application, build type
debug.
Compiling using dmd...
Linking...
--- errorlevel 1
FAIL
.dub\build\application-debug-windows-x86-dmd-5D99A10B3D44C3F39E37BD10F5149BF7\
ddb_test executable
Error executing command build: dmd failed with exit code 1
```

If I comment just a row on app.d:
```
import ddb.postgres;
// import gtk.Window;  = 

int main(string[] argv) {
return 0;
}
```
it works!

Is it a GtkD or ddb or optliker problem?

Incidentally if I try release version (on linux and Win):

```
$dub --build=release

ddb: [ddb]
gtk-d:gtkd: [gtk-d:gtkd]
ddb_test: [ddb_test, ddb, gtk-d:gtkd]
Building ddb configuration library, build type release.
Running dmd...
Building gtk-d:gtkd configuration library, build type release.
Running dmd...
../../../.dub/packages/gtk-d-2.3.3/src/gtk/Builder.d(489): Error:
ICE: cannot append 'char' to 'string'
Internal error: e2ir.c 3204
FAIL
../../../.dub/packages/gtk-d-2.3.3/.dub/build/library-release-linux.posix-x86_64-dmd-AB3D2656D2B9D0AA591491D684B048DC
gtkd-2 staticLibrary
Error executing command run: DMD compile run failed with exit
code 1
```


DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn

I've this dub.json
{
name: ega_editor,
description: Editor for ega database,
 targetType: executable,
 targetPath: bin,
 dependencies: {
   sdlang-d: =0.8.4,
   ddb: =0.2.1,
   dejector: ~master,
   gtk-d:gtkd: =2.3.3
}
}
and under linux it works well.

Under WinXp I got the following

Linking...
dmd
-of.dub\build\application-debug-windows-x86-dmd-78940A919140142F73EC858336385DF4\ega_editor.exe
.dub\build\application-debug-windows-x86-dmd-78940A919140142F73EC858336385DF4\ega_editor.obj
C:\Documents and Settings\dao\Application
Data\dub\packages\dejector-master\dejector.lib C:\Documents and
Settings\dao\Application Data\dub\packages\dunit-1.0.9\dunit.lib
C:\Documents and Settings\dao\Application
Data\dub\packages\sdlang-d-0.8.4\sdlang-d.lib C:\Documents and
Settings\dao\Application Data\dub\packages\ddb-0.2.1\ddb.lib
C:\Documents and Settings\dao\Application
Data\dub\packages\gtk-d-2.3.3\gtkd-2.lib -g
--- errorlevel 1
FAIL
.dub\build\application-debug-windows-x86-dmd-78940A919140142F73EC858336385DF4\
ega_editor executable
Error executing command build: dmd failed with exit code 1

Full exception:
object.Exception@source\dub\compilers\compiler.d(236): dmd failed
with exit code 1

0x004CC9F2
0x00437462
0x004394BA
0x00441FFD
0x004405C1
0x00440240
0x0043FEDE
0x0043FB08
0x00443A06
0x00410549
0x00404D6C
0x00405017
0x00403538
0x00402106
0x004BCD30
0x004BCD03
0x004BCC1B
0x0040271C
0x0050A33D
0x7C816037 in CreateActCtxW

My dub version is DUB version 0.9.22-beta.3, built on Jun 12 2014


Thanks a lot!


Re: DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn

Thank you for your reply...

On Thursday, 19 June 2014 at 12:28:31 UTC, Mathias Lang wrote:
8

AFAIK, D is not officially supported on Win XP.

8

The strange thing is that it worked yesterday and not today. I
have also tried with Win7 64bit (on Virtual Box) and the problem
it's the same...




Re: DUB linking problem on WinXp

2014-06-19 Thread Orfeo via Digitalmars-d-learn

The problem was on ddb 0.2.1 ... if I remove it I can compile


Re: D Users Survey: Primary OS?

2014-05-29 Thread Orfeo via Digitalmars-d

Arch Linux x86_64