On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to)
On Monday, 2 January 2023 at 21:36:10 UTC, Steven Schveighoffer
wrote:
On 1/1/23 6:28 PM, torhu wrote:
I need to parse some JSON data into various data structures,
so I'm looking for a parser based on events or ranges. One
that doesn't just load the file and build a data structure
that
On Saturday, 31 December 2022 at 02:40:49 UTC, Daren Scot Wilson
wrote:
The compiler errors I get are, for no '&' and with '&':
Error: function `app.checkbox_b_clicked(Widget source, bool
checked)` is not callable using argument types `()`
Error: none of the overloads of `opAssign` are
On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote:
Are you asking for a SAX-styled parser for JSON?
Yes, I actually want to replace a SAX parser.
On Monday, 2 January 2023 at 05:44:33 UTC, thebluepandabear wrote:
You might want to try the following:
https://github.com/libmir/asdf
I had a look at that, but I think it just loads the whole file
into it's own data structure. And then you can use attributes to
get it to fill structs with
I need to parse some JSON data into various data structures, so
I'm looking for a parser based on events or ranges. One that
doesn't just load the file and build a data structure that
represents the whole thing. So not std.json, at least.
On Tuesday, 13 December 2022 at 19:50:15 UTC, torhu wrote:
On Tuesday, 13 December 2022 at 19:28:44 UTC, Leonardo A wrote:
Hello. How to use version in dub?
https://dlang.org/spec/version.html
"The version level and version identifier can be set on the
command line by the -version"
I tried
On Tuesday, 13 December 2022 at 19:28:44 UTC, Leonardo A wrote:
Hello. How to use version in dub?
https://dlang.org/spec/version.html
"The version level and version identifier can be set on the
command line by the -version"
I tried everything but noting.
In SDL syntax, either at the top
On Monday, 14 November 2022 at 07:57:16 UTC, Kagamin wrote:
This works for me:
```
shared SyncAA!(string,string) saa;
void f()
{
saa=new shared SyncAA!(string,string)("1","2");
saa.keys();
saa["12"]="34";
saa.remove("12");
}
```
The strange error message I got
On Friday, 11 November 2022 at 14:19:31 UTC, Kagamin wrote:
Try this:
```
private:
V[K] sharedTable;
ref inout(V[K]) unsharedTable() inout
{
return *cast(inout(V[K])*)
}
```
Thanks, that worked! Feels like programming in C, though. If I
could
On Thursday, 10 November 2022 at 21:55:26 UTC, torhu wrote:
I'm trying to make a more thread-safe wrapper for AA's:
```
synchronized final class SyncAA(K, V) ///
I chose to fix this by just using `synchronized (this)` inside
each method instead, for now. Still interested in cleaner
I'm trying to make a more thread-safe wrapper for AA's:
```
synchronized final class SyncAA(K, V) ///
{
///
V opIndex(K key) { return data_[key]; }
///
V opIndexAssign(V value, K key) { return data_[key] = value; }
///
K[] keys() const { return data_.keys; }
///
On Friday, 7 October 2022 at 00:13:59 UTC, matheus wrote:
Hi,
Could anyone please tell me why the properties of min/max of a
char returns a "char type" and not a value as an int?
Well, why whould the highest and lowest values of a type be of a
different type..?
```d
import std;
void
On Thursday, 6 October 2022 at 21:36:48 UTC, rassoc wrote:
And what kind of testing was that? Mind to share? Because I did
the following real quick and wasn't able to measure a "two
orders of magnitude" difference. Sure, the regex version came
on top, but they were both faster than the ruby
On Wednesday, 5 October 2022 at 17:29:25 UTC, Steven
Schveighoffer wrote:
```d
bool isearch(S1, S2)(S1 haystack, S2 needle)
{
import std.uni;
import std.algorithm;
return haystack.asLowerCase.canFind(needle.asLowerCase);
}
```
untested.
-Steve
I did some basic testing, and
On Wednesday, 5 October 2022 at 20:45:55 UTC, torhu wrote:
On Wednesday, 5 October 2022 at 20:40:46 UTC, torhu wrote:
Am I doing something wrong here?
Right, you can instantiate structs without arguments. It's been
ten years since I last used D, I was thinking of structs like
if they were
On Wednesday, 5 October 2022 at 20:40:46 UTC, torhu wrote:
Am I doing something wrong here?
Right, you can instantiate structs without arguments. It's been
ten years since I last used D, I was thinking of structs like if
they were classes.
On Wednesday, 5 October 2022 at 17:29:25 UTC, Steven
Schveighoffer wrote:
[...]
I wanted to do some quick benchmarking to figure out what works.
When I run this:
```d
import std.stdio;
import std.datetime.stopwatch;
void main()
{
auto sw = StopWatch();
sw.stop();
I need a case-insensitive check to see if a string contains
another string for a "quick filter" feature. It should
preferrably be perceived as instant by the user, and needs to
check a few thousand strings in typical cases. Is a regex the
best option, or what would you suggest?
On Wednesday, 28 September 2022 at 12:43:52 UTC, rassoc wrote:
On 9/28/22 02:04, torhu via Digitalmars-d-learn wrote:
Thank you, works like a charm!
It does? How are you formatting `info("foo", 'a', 42)` inside
the template if I may ask?
It works like writefln, so that exa
On Tuesday, 27 September 2022 at 23:18:06 UTC, Adam D Ruppe wrote:
On Tuesday, 27 September 2022 at 22:39:52 UTC, torhu wrote:
How would I achieve something like this, do I have to turn the
aliases into functions?
You can write it out long-form with two steps like this:
Thank you, works
On Tuesday, 27 September 2022 at 22:39:52 UTC, torhu wrote:
How would I achieve something like this, do I have to turn the
aliases into functions?
```d
void _messageBox(string title, int style, T...)(T args)
{
string s = format(args);
/* etc... */
}
alias _messageBox!(APPNAME,
How would I achieve something like this, do I have to turn the
aliases into functions?
```d
void _messageBox(string title, int style, T...)(T args)
{
string s = format(args);
/* etc... */
}
alias _messageBox!(APPNAME, SWT.ICON_INFORMATION) info;
alias _messageBox!("Warning",
23 matches
Mail list logo