I know that a lot of people are using for programming tools like
Sublime. I am one of them. But if for very simple code it's ok,
how to write hard code?
Do you often need debugger when you are writing code? For which
tasks debugger are more needed for you?
We have to look at the documentation of the function. In this
case the possibilities are FileException and UTFException.
http://dlang.org/phobos/std_file.html#.readText
However, judging by their names, they are both descendants of
Exception, so what you are doing will catch either of them.
void openFile(string fname, string current_folder)
{
auto file = readText(current_folder ~ fname);
scope(failure)
{
writeln(failure);
}
// writeln(file);
}
if file name do not exists, I want to rise scope exception. But
it's do not rise,
I can't understand what I am missing. Try-catch block also do not
handle exception:
void main()
{
string fname = app.d1; //file name with error
string current_folder = (getcwd() ~\\);
writeln(current_folder);
openFile(fname, current_folder);
}
void
Am I right understand that keyword Exception is handle
universal type of exceptions?
catch (Exception)
{
writeln(inner);
}
But in my example with try block can I change it's to something
more informative?
Replace that with something like writeln(caught) and you will
see that it is indeed caught. :) Printing the exception mimicks
the default behavior and you (and I) think that the exception
is not caught. :)
that's work, but I can not understand where I can to look at
exception level. If I
Thanks! In which cases tuples can be helpful?
Few questions.
1. In examples tuples are created with keyword auto. Can I create
them with another keyword. Or auto mean structure of data, that
have not standard type like (int or string)?
2. How ti expend tuple? I tried to do:
auto imglist = tuple(aaa);
imglist.expand[sss];
Is it's possible to create single language that cover desktop and
web? Like D+Dart?
I ask becouse I can't understand why it's need 2 language if they
are very simmiler and it's can be 1 language instead 2.
I know that there is way to write all on JS. But I can't
understand what the reason that there are no single language that
can work on web and as native language.
It is possible, but you need to design the language within the
constraints of javascript:
1. single threaded (or worker threads)
2. 53 bits integers, 26 bits for multiplies.
4. weird fixed size heaps (ArrayView)
5. if garbage collection then it has to be javascript style
6. no tricks:
No! I mean not translation to js. I mean theoretical ability of
creation new programming language that can work every where!
Unfortunately that library has no dub package.
But you can include it in your project.
See info here http://code.dlang.org/package-format
I can't understand how to set in dub that I need to to include in
compilation process other files... Could you help me?
Where I can find compatibility with D online regexp constructor?
I found only https://github.com/Bystroushaak/DHTMLParser
But I can't get it work:
C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-masterdmd
find_links.d
OPTLINK (R) for Win32 Release 8.00.15
Copyright (C) Digital Mars 1989-2013 All rights reserved.
You need to pass a library to compiler as well (all its files
or .lib/.a file) if it is compiled as static library
You can try
dmd find_links.d dhtmlparser.d quote_escaper.d
C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-masterdmd
find_links.d quote_escaper.d
OPTLINK (R) for
On Saturday, 25 October 2014 at 19:51:48 UTC, Suliman wrote:
You need to pass a library to compiler as well (all its files
or .lib/.a file) if it is compiled as static library
You can try
dmd find_links.d dhtmlparser.d quote_escaper.d
How I can build such App with DUB?
import std.stdio;
import std.conv;
import std.string;
import std.net.curl;
void main()
{
string content = get(d-lang.appspot.com/testUrl2);
}
Error: cannot implicitly convert expression (get(d-lang.appsp
ot.com/testUrl2, AutoProtocol())) of type char[] to string
code from:
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
I am planing to buy ARM-Board. I would use it for internet
browsing and whant to know would it's possible to develop D apps
on it?
I had read that LDC have limited support of ARM. wiki said that
it can compile hello-world apps. But it it not enough.
What about DMD. Is there any progress of
What is the best way to remove file name from full path?
string path = thisExePath()
string path = thisExePath()
Seems like dirName in std.path is a good candidate ;)
http://dlang.org/phobos/std_path.html#.dirName
You'll find many other path manipulation functions there.
Thanks! But if I want to strip it, how I can cut it?
I can't understand how to use strip? For example I would like to
cut just extension.
path = path.stripRight(exe);
Error: no overload matches for stripRight(C)(C[] str) if
string getFileName()
{
//чтобы было проще обрабатываемый файл будем хранить рядом с
бинариком
string filename = chomp(readln());
string path = getcwd();
writeln((path ~ \\ ~ filename));
if (exists(path ~ \\ ~ filename))
return (path ~ \\ ~
Already 1 hour I am looking at example from
http://ddili.org/ders/d.en/concurrency.html and my modification
of it, and can't understand what's difference? Why it's output
only:
1
3
and then do not do nothing!
import std.stdio;
import std.concurrency;
import core.thread;
void main()
{
void worker()
{
int value = 0;
while (value =10)
{
value = receiveOnly!int();
writeln(value);
int result = value * 3;
ownerTid.send(result);
}
}
give me:
Running .\app1.exe
2
6
3
9
4
12
5
15
6
18
Is it's possible to change dub package cache dir?
How can I feel struct with foreach loop?
struct ConfigStruct
{
string [string] key1;
string [string] key2;
}
ConfigStruct confstruct;
foreach (i, line; readText(ConfigName).splitLines())
{
string [] keyvalue = line.split(=);
confstruct.key1[keyvalue[0]] = keyvalue[1];
}
it's ok for 1
void main()
{
auto result = readconfig();
foreach (_; result)
{
// I want to iterate result that I got from structure.
}
}
auto readconfig()
{
struct ConfigStruct
{
string key1;
string key2;
foreach (field; result.tupleof)
Why I should here specify type of iterable element, but not first
element that I use for iteration?
I mean:
foreach (_some_type_possible_enum_ field; result)
?
bool[4] x = [1, 1, 0, 0];
BitArray ba = BitArray(x);
When I try to compile this I am getting error:
source\app.d(13): Error: cannot implicitly convert expression (x)
of type bool[4] to uint
What I am doing wrong?
A lot of developers will say thanks if you help with developing
DGUI https://bitbucket.org/dgui/dgui/
D very need native and easy to use GUI lib...
DFL is really cool. Not all programmers need complex toolkits. A
lot of need easy to learning toolkits for medium projects.
It would be cool if somebody will handle developing of DFL. It's
better to have one such toolkit, than tons of complex and not
finished toolkits.
I have got same error. I need to pass in instance of class
constant, but got error Error: static variable cannot be read
at compile
http://www.everfall.com/paste/id.php?1mc9mb9cxyie
When I had create instance of class in main, and create
confvarible above it all worked, but when I had moved
Thanks! But is there any other solution? I am thinking that I am
trying to specify config name by wrong way...
I am tying to hardcode name of config file name. Then I would
read and parse it.
I am trying to write simple parser, that split text to
key value
name = david
lastname = wood
here is my code:
foreach (line; readText(confname).splitLines())
{
writeln(line);
foreach (str; split(line, =))
I am trying to compile next code:
import std.net.curl;
import std.stdio;
void main()
{
writeln(get(https://google.com/;));
}
and got next error
http://www.everfall.com/paste/id.php?y37dr6qmu54h
401 - 439 of 439 matches
Mail list logo